summary refs log tree commit diff
path: root/grp/initgroups.c
diff options
context:
space:
mode:
Diffstat (limited to 'grp/initgroups.c')
-rw-r--r--grp/initgroups.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/grp/initgroups.c b/grp/initgroups.c
index fd30ebf7e0..06c48bb040 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989, 91, 93, 96, 97, 98, 99 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 91, 93, 1996-1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -163,7 +163,10 @@ initgroups (user, group)
     size = 16;
 #endif
 
-  groups = malloc (size * sizeof (gid_t *));
+  groups = (gid_t *) malloc (size * sizeof (gid_t));
+  if (__builtin_expect (groups == NULL, 0))
+    /* No more memory.  */
+    return -1;
 
   groups[0] = group;