summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-08-19 18:25:14 +0000
committerJeremy Allison <jra@samba.org>2001-08-19 18:25:14 +0000
commit5f0b9d08303aeddb01019ff2a63001c9dfa3088b (patch)
tree032b31bb44dee945ba01d418463a110963924254
parenta680611c0bbc77955ce2b7f2c8668915c1b6c3d2 (diff)
downloadsamba-5f0b9d08303aeddb01019ff2a63001c9dfa3088b.tar.gz
samba-5f0b9d08303aeddb01019ff2a63001c9dfa3088b.tar.bz2
samba-5f0b9d08303aeddb01019ff2a63001c9dfa3088b.zip
Realloc fix.
Jeremy. (This used to be commit 82153dde951ff7af3655f466cb2ea42c3195bdff)
-rw-r--r--source3/groupdb/groupdb.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/source3/groupdb/groupdb.c b/source3/groupdb/groupdb.c
index 4b7795c57b..227d63e8e3 100644
--- a/source3/groupdb/groupdb.c
+++ b/source3/groupdb/groupdb.c
@@ -141,16 +141,15 @@ BOOL add_domain_group(DOMAIN_GRP **grps, int *num_grps, DOMAIN_GRP *grp)
DOMAIN_GRP *tgrps;
if (grps == NULL || num_grps == NULL || grp == NULL)
- {
return False;
- }
tgrps = Realloc((*grps), ((*num_grps)+1) * sizeof(DOMAIN_GRP));
- if (tgrps == NULL)
- {
+ if (tgrps == NULL) {
+ if (*grps)
+ free(*grps);
return False;
- }
- else (*grps) = tgrps;
+ } else
+ (*grps) = tgrps;
DEBUG(10,("adding group %s(%s)\n", grp->name, grp->comment));