aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-08-03 15:31:32 +0000
committerUlrich Drepper <drepper@redhat.com>2006-08-03 15:31:32 +0000
commit39571a1360afca37d7b9a4343eed90f4aadb4f90 (patch)
tree1ae79657a7c5ee190732aabf72c288bb1bca57f0
parent6c215a8d6c972ca3324107109c393f21e782fb10 (diff)
downloadglibc-39571a1360afca37d7b9a4343eed90f4aadb4f90.tar
glibc-39571a1360afca37d7b9a4343eed90f4aadb4f90.tar.gz
glibc-39571a1360afca37d7b9a4343eed90f4aadb4f90.tar.bz2
glibc-39571a1360afca37d7b9a4343eed90f4aadb4f90.zip
(getgrouplist): Simplify code a bit. Don't allocate one additional
element on NEWGROUPS.
-rw-r--r--ChangeLog4
-rw-r--r--grp/initgroups.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index e24281bfba..be8a1f08c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,10 @@
2006-08-03 Ulrich Drepper <drepper@redhat.com>
+
* grp/initgroups.c (internal_getgrouplist): Remove unnecessary
test introduced in patch for bz #661.
- (getgrouplist): Simplify code a bit.
+ (getgrouplist): Simplify code a bit. Don't allocate one additional
+ element on NEWGROUPS.
[BZ #2908]
* stdio-common/printf_fphex.c (__printf_fphex): When rounding up
diff --git a/grp/initgroups.c b/grp/initgroups.c
index 1cc07b6bef..883ea71680 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -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