summaryrefslogtreecommitdiff
path: root/sys/compat/linux/common/linux_misc.c
diff options
context:
space:
mode:
authorerh <erh@NetBSD.org>2006-03-17 06:01:14 +0000
committererh <erh@NetBSD.org>2006-03-17 06:01:14 +0000
commit8ad33681f82fef9799f68cdb26aef3200429262d (patch)
tree8c7237960110733090cc8f447494c9ff38fc7f0f /sys/compat/linux/common/linux_misc.c
parent6434af65ceb950b657d03950bd6685eecf3df93f (diff)
Fix Coverity issues 2321 and 2320. Make sure to free allocated memory.
Diffstat (limited to 'sys/compat/linux/common/linux_misc.c')
-rw-r--r--sys/compat/linux/common/linux_misc.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c
index 4c94c33965b..403e4903e9d 100644
--- a/sys/compat/linux/common/linux_misc.c
+++ b/sys/compat/linux/common/linux_misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_misc.c,v 1.151 2006/03/01 12:38:12 yamt Exp $ */
+/* $NetBSD: linux_misc.c,v 1.152 2006/03/17 06:01:14 erh Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.151 2006/03/01 12:38:12 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.152 2006/03/17 06:01:14 erh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1251,7 +1251,10 @@ linux_sys_getgroups16(l, v, retval)
kbset = malloc(n * sizeof (gid_t), M_TEMP, M_WAITOK);
lset = malloc(n * sizeof (linux_gid_t), M_TEMP, M_WAITOK);
if (bset == NULL || kbset == NULL || lset == NULL)
- return ENOMEM;
+ {
+ error = ENOMEM;
+ goto out;
+ }
SCARG(&bsa, gidsetsize) = n;
SCARG(&bsa, gidset) = bset;
error = sys_getgroups(l, &bsa, retval);
@@ -1299,8 +1302,11 @@ linux_sys_setgroups16(l, v, retval)
bset = stackgap_alloc(p, &sg, n * sizeof (gid_t));
lset = malloc(n * sizeof (linux_gid_t), M_TEMP, M_WAITOK);
kbset = malloc(n * sizeof (gid_t), M_TEMP, M_WAITOK);
- if (lset == NULL || bset == NULL)
- return ENOMEM;
+ if (bset == NULL || kbset == NULL || lset == NULL)
+ {
+ error = ENOMEM;
+ goto out;
+ }
error = copyin(SCARG(uap, gidset), lset, n * sizeof (linux_gid_t));
if (error != 0)
goto out;