diff options
author | Simo Sorce <idra@samba.org> | 2001-08-12 17:30:01 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2001-08-12 17:30:01 +0000 |
commit | 2e783a47076bd0994b6ce86df7ec967bc1c2da63 (patch) | |
tree | c6504d6e8396eef290fe499abb8586b758f1f3d4 /source3/groupdb/aliasfile.c | |
parent | ddec8306586414cc02eca612777bb547cb8dbcae (diff) | |
download | samba-2e783a47076bd0994b6ce86df7ec967bc1c2da63.tar.gz samba-2e783a47076bd0994b6ce86df7ec967bc1c2da63.tar.bz2 samba-2e783a47076bd0994b6ce86df7ec967bc1c2da63.zip |
this is a big global fix for the ptr = Realloc(ptr, size) bug.
many possible mem leaks, and segfaults fixed.
someone should port this fix to 2.2 also.
(This used to be commit fa8e55b8b465114ce209344965c1ca0333b84db9)
Diffstat (limited to 'source3/groupdb/aliasfile.c')
-rw-r--r-- | source3/groupdb/aliasfile.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source3/groupdb/aliasfile.c b/source3/groupdb/aliasfile.c index 4b8bbe3079..2735fef38f 100644 --- a/source3/groupdb/aliasfile.c +++ b/source3/groupdb/aliasfile.c @@ -128,12 +128,13 @@ static char *get_alias_members(char *p, int *num_mem, LOCAL_GRP_MEMBER **members while (next_token(&p, name, ",", sizeof(fstring))) { + LOCAL_GRP_MEMBER *mbrs; DOM_SID sid; uint8 type; if (lookup_sid(name, &sid, &type)) { - (*members) = Realloc((*members), ((*num_mem)+1) * sizeof(LOCAL_GRP_MEMBER)); + mbrs = Realloc((*members), ((*num_mem)+1) * sizeof(LOCAL_GRP_MEMBER)); (*num_mem)++; } else @@ -141,10 +142,12 @@ static char *get_alias_members(char *p, int *num_mem, LOCAL_GRP_MEMBER **members DEBUG(0,("alias database: could not resolve alias named %s\n", name)); continue; } - if ((*members) == NULL) + if (mbrs == NULL) { return NULL; } + else (*members) = mbrs; + fstrcpy((*members)[(*num_mem)-1].name, name); (*members)[(*num_mem)-1].sid_use = type; sid_copy(&(*members)[(*num_mem)-1].sid, &sid); |