Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/chfs Plug memory leak in a corner case in chfs_get_d...



details:   https://anonhg.NetBSD.org/src/rev/36539efed0e5
branches:  trunk
changeset: 331946:36539efed0e5
user:      he <he%NetBSD.org@localhost>
date:      Mon Sep 01 16:31:17 2014 +0000

description:
Plug memory leak in a corner case in chfs_get_data_nodes().

diffstat:

 sys/ufs/chfs/chfs_readinode.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 985de2e70490 -r 36539efed0e5 sys/ufs/chfs/chfs_readinode.c
--- a/sys/ufs/chfs/chfs_readinode.c     Mon Sep 01 16:27:38 2014 +0000
+++ b/sys/ufs/chfs/chfs_readinode.c     Mon Sep 01 16:31:17 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chfs_readinode.c,v 1.8 2013/10/20 17:18:38 christos Exp $      */
+/*     $NetBSD: chfs_readinode.c,v 1.9 2014/09/01 16:31:17 he Exp $    */
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -801,8 +801,10 @@
        buf = kmem_alloc(len, KM_SLEEP);
 
        dnode = kmem_alloc(len, KM_SLEEP);
-       if (!dnode)
+       if (!dnode) {
+               kmem_free(buf, len);
                return ENOMEM;
+       }
 
        nref = chfs_first_valid_data_ref(ip->chvc->dnode);
 



Home | Main Index | Thread Index | Old Index