Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Fix memory leak on the following cases when device ...



details:   https://anonhg.NetBSD.org/src/rev/63c173e72921
branches:  trunk
changeset: 786316:63c173e72921
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Apr 26 09:04:43 2013 +0000

description:
Fix memory leak on the following cases when device attached or detached:
 - No one open drvctl.
 - kmem_alloc() failed in devmon_insert().

XXX pullup to both netbsd-5 and netbsd-6.

diffstat:

 sys/kern/kern_drvctl.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 1a8503adcee8 -r 63c173e72921 sys/kern/kern_drvctl.c
--- a/sys/kern/kern_drvctl.c    Thu Apr 25 23:15:14 2013 +0000
+++ b/sys/kern/kern_drvctl.c    Fri Apr 26 09:04:43 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_drvctl.c,v 1.33 2012/10/27 17:18:39 chs Exp $ */
+/* $NetBSD: kern_drvctl.c,v 1.34 2013/04/26 09:04:43 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2004
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_drvctl.c,v 1.33 2012/10/27 17:18:39 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_drvctl.c,v 1.34 2013/04/26 09:04:43 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -115,6 +115,7 @@
        mutex_enter(&drvctl_lock);
 
        if (drvctl_nopen == 0) {
+               prop_object_release(ev);
                mutex_exit(&drvctl_lock);
                return;
        }
@@ -128,6 +129,7 @@
 
        dce = kmem_alloc(sizeof(*dce), KM_SLEEP);
        if (dce == NULL) {
+               prop_object_release(ev);
                mutex_exit(&drvctl_lock);
                return;
        }



Home | Main Index | Thread Index | Old Index