summaryrefslogtreecommitdiff
path: root/libc/inet/rpc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-12-28 21:20:42 +0000
committerMike Frysinger <vapier@gentoo.org>2005-12-28 21:20:42 +0000
commit8e376ca602cd2377681e5c533c0a061764e184e7 (patch)
tree3e2831b9c9dd63e75d3feb14892c8cf4682e9abf /libc/inet/rpc
parentba56672d0f0932384b3b749b48173f14ae9dc6fc (diff)
make sure we handle the (malloc(0)==NULL) case as Aubrey points out via the e-mail list
Diffstat (limited to 'libc/inet/rpc')
-rw-r--r--libc/inet/rpc/auth_unix.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libc/inet/rpc/auth_unix.c b/libc/inet/rpc/auth_unix.c
index 3cb286cc4..bb14df068 100644
--- a/libc/inet/rpc/auth_unix.c
+++ b/libc/inet/rpc/auth_unix.c
@@ -183,12 +183,14 @@ __authunix_create_default (void)
uid_t uid;
gid_t gid;
int max_nr_groups = sysconf (_SC_NGROUPS_MAX);
- gid_t *gids;
+ gid_t *gids = NULL;
AUTH *ret_auth;
- gids = (gid_t*)malloc(sizeof(*gids) * max_nr_groups);
- if (gids == NULL)
- abort ();
+ if (max_nr_groups) {
+ gids = (gid_t*)malloc(sizeof(*gids) * max_nr_groups);
+ if (gids == NULL)
+ abort ();
+ }
if (gethostname (machname, MAX_MACHINE_NAME) == -1)
abort ();
@@ -202,7 +204,8 @@ __authunix_create_default (void)
list of groups to NGRPS members since the code in
authuxprot.c transforms a fixed array. Grrr. */
ret_auth = __authunix_create (machname, uid, gid, MIN (NGRPS, len), gids);
- free (gids);
+ if (gids)
+ free (gids);
return ret_auth;
}
strong_alias(__authunix_create_default,authunix_create_default)