Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Memory leak, found by Mootja. By the way, we probab...
details: https://anonhg.NetBSD.org/src/rev/2901d4d2b731
branches: trunk
changeset: 348639:2901d4d2b731
user: maxv <maxv%NetBSD.org@localhost>
date: Mon Oct 31 15:08:45 2016 +0000
description:
Memory leak, found by Mootja. By the way, we probably shouldn't be
returning -1 here.
diffstat:
sys/kern/uipc_sem.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (32 lines):
diff -r 4865e66fba6f -r 2901d4d2b731 sys/kern/uipc_sem.c
--- a/sys/kern/uipc_sem.c Mon Oct 31 15:05:05 2016 +0000
+++ b/sys/kern/uipc_sem.c Mon Oct 31 15:08:45 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_sem.c,v 1.46 2016/06/10 23:24:33 christos Exp $ */
+/* $NetBSD: uipc_sem.c,v 1.47 2016/10/31 15:08:45 maxv Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.46 2016/06/10 23:24:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.47 2016/10/31 15:08:45 maxv Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -335,9 +335,11 @@
}
if (atomic_inc_uint_nv(&l->l_proc->p_nsems) > SEM_NSEMS_MAX) {
- atomic_dec_uint(&l->l_proc->p_nsems);
+ atomic_dec_uint(&l->l_proc->p_nsems);
+ if (kname != NULL)
+ kmem_free(kname, len);
return -1;
- }
+ }
ks = kmem_zalloc(sizeof(ksem_t), KM_SLEEP);
mutex_init(&ks->ks_lock, MUTEX_DEFAULT, IPL_NONE);
Home |
Main Index |
Thread Index |
Old Index