Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/linux/common Resource leak.
details: https://anonhg.NetBSD.org/src/rev/9bc3d4067fa8
branches: trunk
changeset: 333120:9bc3d4067fa8
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Oct 19 17:33:58 2014 +0000
description:
Resource leak.
Found by my code scanner.
Tested by njoly@; ok njoly@ rmind@ on tech-kern@.
diffstat:
sys/compat/linux/common/linux_uselib.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diffs (61 lines):
diff -r 8976fb8e5af5 -r 9bc3d4067fa8 sys/compat/linux/common/linux_uselib.c
--- a/sys/compat/linux/common/linux_uselib.c Sun Oct 19 17:01:40 2014 +0000
+++ b/sys/compat/linux/common/linux_uselib.c Sun Oct 19 17:33:58 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_uselib.c,v 1.30 2009/08/28 01:39:03 dholland Exp $ */
+/* $NetBSD: linux_uselib.c,v 1.31 2014/10/19 17:33:58 maxv Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_uselib.c,v 1.30 2009/08/28 01:39:03 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_uselib.c,v 1.31 2014/10/19 17:33:58 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -103,17 +103,18 @@
if ((error = vn_rdwr(UIO_READ, vp, (void *) &hdr, LINUX_AOUT_HDR_SIZE,
0, UIO_SYSSPACE, IO_NODELOCKED, l->l_cred,
&rem, NULL))) {
- vrele(vp);
- return error;
+ goto out;
}
if (rem != 0) {
- vrele(vp);
- return ENOEXEC;
+ error = ENOEXEC;
+ goto out;
}
- if (LINUX_N_MACHTYPE(&hdr) != LINUX_MID_MACHINE)
- return ENOEXEC;
+ if (LINUX_N_MACHTYPE(&hdr) != LINUX_MID_MACHINE) {
+ error = ENOEXEC;
+ goto out;
+ }
magic = LINUX_N_MAGIC(&hdr);
taddr = hdr.a_entry & (~(PAGE_SIZE - 1));
@@ -123,7 +124,7 @@
error = vn_marktext(vp);
if (error)
- return (error);
+ goto out;
vcset.evs_cnt = 0;
vcset.evs_used = 0;
@@ -150,7 +151,7 @@
kill_vmcmds(&vcset);
+out:
vrele(vp);
-
return error;
}
Home |
Main Index |
Thread Index |
Old Index