From 5f0b9d08303aeddb01019ff2a63001c9dfa3088b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 19 Aug 2001 18:25:14 +0000 Subject: Realloc fix. Jeremy. (This used to be commit 82153dde951ff7af3655f466cb2ea42c3195bdff) --- source3/groupdb/groupdb.c | 11 +++++------ 1 file 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)); -- cgit