From e28ae1f5fd904b99403e31edbb1ca41f77dc1dee Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 4 Oct 2006 21:07:05 +0000 Subject: r19080: Fix a potential NULL dereference (This used to be commit 682b490c23bb88a1a570bd1fcb7d2b6aa778dd14) --- source3/lib/util.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source3/lib') 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; -- cgit