mirror of
https://sourceware.org/git/glibc.git
synced 2025-12-24 17:51:17 +03:00
(getgrouplist): Simplify code a bit. Don't allocate one additional
element on NEWGROUPS.
This commit is contained in:
@@ -144,7 +144,7 @@ getgrouplist (const char *user, gid_t group, gid_t *groups, int *ngroups)
|
||||
{
|
||||
long int size = MAX (1, *ngroups);
|
||||
|
||||
gid_t *newgroups = (gid_t *) malloc ((size + 1) * sizeof (gid_t));
|
||||
gid_t *newgroups = (gid_t *) malloc (size * sizeof (gid_t));
|
||||
if (__builtin_expect (newgroups == NULL, 0))
|
||||
/* No more memory. */
|
||||
// XXX This is wrong. The user provided memory, we have to use
|
||||
|
||||
Reference in New Issue
Block a user