svn commit: trunk/uClibc/libc/inet/rpc
vapier at uclibc.org
vapier at uclibc.org
Wed Dec 28 21:20:43 UTC 2005
Author: vapier
Date: 2005-12-28 13:20:42 -0800 (Wed, 28 Dec 2005)
New Revision: 12999
Log:
make sure we handle the (malloc(0)==NULL) case as Aubrey points out via the e-mail list
Modified:
trunk/uClibc/libc/inet/rpc/auth_unix.c
Changeset:
Modified: trunk/uClibc/libc/inet/rpc/auth_unix.c
===================================================================
--- trunk/uClibc/libc/inet/rpc/auth_unix.c 2005-12-28 21:19:58 UTC (rev 12998)
+++ trunk/uClibc/libc/inet/rpc/auth_unix.c 2005-12-28 21:20:42 UTC (rev 12999)
@@ -183,12 +183,14 @@
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 @@
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)
More information about the uClibc-cvs
mailing list