Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Fix leak in a posix_spawn error path, from Greg Oster.
details: https://anonhg.NetBSD.org/src/rev/30085259a76f
branches: trunk
changeset: 778834:30085259a76f
user: martin <martin%NetBSD.org@localhost>
date: Sun Apr 15 15:35:00 2012 +0000
description:
Fix leak in a posix_spawn error path, from Greg Oster.
diffstat:
sys/kern/kern_exec.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (36 lines):
diff -r 51349010ea33 -r 30085259a76f sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c Sun Apr 15 10:34:14 2012 +0000
+++ b/sys/kern/kern_exec.c Sun Apr 15 15:35:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exec.c,v 1.349 2012/04/09 19:42:06 martin Exp $ */
+/* $NetBSD: kern_exec.c,v 1.350 2012/04/15 15:35:00 martin Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.349 2012/04/09 19:42:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.350 2012/04/15 15:35:00 martin Exp $");
#include "opt_exec.h"
#include "opt_ktrace.h"
@@ -1978,8 +1978,16 @@
return;
report_error:
- if (have_reflock)
+ if (have_reflock) {
+ /*
+ * We have not passed through execve_runproc(),
+ * which would have released the p_reflock and also
+ * taken ownership of the sed_exec part of spawn_data,
+ * so release/free both here.
+ */
rw_exit(&l->l_proc->p_reflock);
+ execve_free_data(&spawn_data->sed_exec);
+ }
if (parent_is_waiting) {
/* pass error to parent */
Home |
Main Index |
Thread Index |
Old Index