Module Name: src
Committed By: christos
Date: Sat Apr 4 15:39:40 UTC 2015
Modified Files:
src/sys/dev/hpc: hpcfb.c
Log Message:
fix leak, found by Brainy.
To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/hpc/hpcfb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/hpc/hpcfb.c
diff -u src/sys/dev/hpc/hpcfb.c:1.58 src/sys/dev/hpc/hpcfb.c:1.59
--- src/sys/dev/hpc/hpcfb.c:1.58 Sat Nov 13 08:51:59 2010
+++ src/sys/dev/hpc/hpcfb.c Sat Apr 4 11:39:40 2015
@@ -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,
}
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
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);