Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump/rumpvfs Fix some rump_etfs_register/rump_et...



details:   https://anonhg.NetBSD.org/src/rev/60ccee01e564
branches:  trunk
changeset: 755676:60ccee01e564
user:      njoly <njoly%NetBSD.org@localhost>
date:      Tue Jun 15 17:23:31 2010 +0000

description:
Fix some rump_etfs_register/rump_etfs_remove memory leaks.

diffstat:

 sys/rump/librump/rumpvfs/rumpfs.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r ef8ca81b264d -r 60ccee01e564 sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Tue Jun 15 09:43:36 2010 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Tue Jun 15 17:23:31 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpfs.c,v 1.51 2010/06/14 13:40:25 njoly Exp $        */
+/*     $NetBSD: rumpfs.c,v 1.52 2010/06/15 17:23:31 njoly Exp $        */
 
 /*
  * Copyright (c) 2009  Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.51 2010/06/14 13:40:25 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.52 2010/06/15 17:23:31 njoly Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -325,6 +325,9 @@
        mutex_enter(&etfs_lock);
        if (etfs_find(key, NULL, REGDIR(ftype))) {
                mutex_exit(&etfs_lock);
+               if (et->et_rn->rn_hostpath != NULL)
+                       free(et->et_rn->rn_hostpath, M_TEMP);
+               kmem_free(et->et_rn, sizeof(*et->et_rn));
                kmem_free(et, sizeof(*et));
                /* XXX: rumpblk_deregister(hostpath); */
                return EEXIST;
@@ -373,6 +376,9 @@
        LIST_FOREACH(et, &etfs_list, et_entries) {
                if (keylen == et->et_keylen && strcmp(et->et_key, key) == 0) {
                        LIST_REMOVE(et, et_entries);
+                       if (et->et_rn->rn_hostpath != NULL)
+                               free(et->et_rn->rn_hostpath, M_TEMP);
+                       kmem_free(et->et_rn, sizeof(*et->et_rn));
                        kmem_free(et, sizeof(*et));
                        break;
                }



Home | Main Index | Thread Index | Old Index