diff options
Diffstat (limited to 'source3/lib/util.c')
-rw-r--r-- | source3/lib/util.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index 8f6a381944..d945bca5a7 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -277,7 +277,8 @@ const char *tmpdir(void) Add a gid to an array of gids if it's not already there. ****************************************************************************/ -void add_gid_to_array_unique(gid_t gid, gid_t **gids, int *num) +void add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid, + gid_t **gids, int *num) { int i; @@ -285,8 +286,11 @@ void add_gid_to_array_unique(gid_t gid, gid_t **gids, int *num) if ((*gids)[i] == gid) return; } - - *gids = SMB_REALLOC_ARRAY(*gids, gid_t, *num+1); + + if (mem_ctx != NULL) + *gids = TALLOC_REALLOC_ARRAY(mem_ctx, *gids, gid_t, *num+1); + else + *gids = SMB_REALLOC_ARRAY(*gids, gid_t, *num+1); if (*gids == NULL) return; |