summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2015-04-04 15:33:36 +0000
committerchristos <christos@NetBSD.org>2015-04-04 15:33:36 +0000
commita40727ea1a1aa415f7d5b2f72d212a53b00276bb (patch)
tree769fdc2e0b77d863eb6d0b874b976b9dffe86253 /sys/dev
parent558580bc2e74dce0abba15555b5b12f57263586b (diff)
fix leak, found by Brainy.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/hpc/hpcfb.c17
-rw-r--r--sys/dev/usb/umass_isdata.c11
2 files changed, 17 insertions, 11 deletions
diff --git a/sys/dev/hpc/hpcfb.c b/sys/dev/hpc/hpcfb.c
index aa9eaecd8b6..b58f59cf061 100644
--- a/sys/dev/hpc/hpcfb.c
+++ b/sys/dev/hpc/hpcfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hpcfb.c,v 1.58 2010/11/13 13:51:59 uebayasi Exp $ */
+/* $NetBSD: hpcfb.c,v 1.59 2015/04/04 15:39:40 christos Exp $ */
/*-
* Copyright (c) 1999
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.58 2010/11/13 13:51:59 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.59 2015/04/04 15:39:40 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_hpcfb.h"
@@ -472,7 +472,8 @@ hpcfb_init(struct hpcfb_fbconf *fbconf, struct hpcfb_devconfig *dc)
}
if (rasops_init(ri, HPCFB_MAX_ROW, HPCFB_MAX_COLUMN)) {
- panic("%s(%d): rasops_init() failed!", __FILE__, __LINE__);
+ aprint_error_dev(dc->dc_sc->sc_dev, "rasops_init() failed!")
+ return -1;
}
/* over write color map of rasops */
@@ -722,13 +723,15 @@ hpcfb_alloc_screen(void *v, const struct wsscreen_descr *type,
DPRINTF(("%s(%d): hpcfb_alloc_screen()\n", __FILE__, __LINE__));
- dc = malloc(sizeof(struct hpcfb_devconfig), M_DEVBUF, M_WAITOK|M_ZERO);
+ dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK|M_ZERO);
if (dc == NULL)
- return (ENOMEM);
+ return ENOMEM;
dc->dc_sc = sc;
- if (hpcfb_init(&sc->sc_fbconflist[0], dc) != 0)
- return (EINVAL);
+ if (hpcfb_init(&sc->sc_fbconflist[0], dc) != 0) {
+ free(dc, M_DEVBUF);
+ return EINVAL;
+ }
if (sc->sc_accessops->font) {
sc->sc_accessops->font(sc->sc_accessctx,
dc->dc_rinfo.ri_font);
diff --git a/sys/dev/usb/umass_isdata.c b/sys/dev/usb/umass_isdata.c
index ab8987032c1..39c1db399b6 100644
--- a/sys/dev/usb/umass_isdata.c
+++ b/sys/dev/usb/umass_isdata.c
@@ -1,4 +1,4 @@
-/* $NetBSD: umass_isdata.c,v 1.30 2014/09/12 16:40:38 skrll Exp $ */
+/* $NetBSD: umass_isdata.c,v 1.31 2015/04/04 15:33:36 christos Exp $ */
/*
* TODO:
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass_isdata.c,v 1.30 2014/09/12 16:40:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_isdata.c,v 1.31 2015/04/04 15:33:36 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -195,8 +195,11 @@ umass_isdata_attach(struct umass_softc *sc)
USETW(req.wLength, sizeof *cf);
err = usbd_do_request(sc->sc_udev, &req, cf);
- if (err)
- return (EIO);
+ if (err) {
+ sc->bus = NULL;
+ free(scbus, M_DEVBUF);
+ return EIO;
+ }
DPRINTF(("umass_wd_attach info:\n EventNotification=0x%02x "
"ExternalClock=0x%02x ATAInitTimeout=0x%02x\n"
" ATAMisc1=0x%02x ATAMajorCommand=0x%02x "