summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index e04ed977bb..19c6cab5b2 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -312,6 +312,13 @@ void add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid,
{
int i;
+ if ((*num_gids != 0) && (*gids == NULL)) {
+ /*
+ * A former call to this routine has failed to allocate memory
+ */
+ return;
+ }
+
for (i=0; i<*num_gids; i++) {
if ((*gids)[i] == gid)
return;