Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/common Memory leak, triggerable from root only.



details:   https://anonhg.NetBSD.org/src/rev/e04d6d8d43c1
branches:  trunk
changeset: 803270:e04d6d8d43c1
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Oct 20 06:56:38 2014 +0000

description:
Memory leak, triggerable from root only.

Found by my code scanner.

ok christos@

diffstat:

 sys/compat/common/vfs_syscalls_30.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 4de09946d203 -r e04d6d8d43c1 sys/compat/common/vfs_syscalls_30.c
--- a/sys/compat/common/vfs_syscalls_30.c       Mon Oct 20 06:41:51 2014 +0000
+++ b/sys/compat/common/vfs_syscalls_30.c       Mon Oct 20 06:56:38 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls_30.c,v 1.34 2014/09/05 09:21:54 matt Exp $        */
+/*     $NetBSD: vfs_syscalls_30.c,v 1.35 2014/10/20 06:56:38 maxv Exp $        */
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.34 2014/09/05 09:21:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.35 2014/10/20 06:56:38 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -356,9 +356,13 @@
        }
        NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb);
        error = namei(&nd);
-       if (error)
+       if (error) {
+               pathbuf_destroy(pb);
                return (error);
+       }
        vp = nd.ni_vp;
+       pathbuf_destroy(pb);
+
        sz = sizeof(struct compat_30_fhandle);
        error = vfs_composefh(vp, (void *)&fh, &sz);
        vput(vp);



Home | Main Index | Thread Index | Old Index