summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_group.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-10-03 21:10:29 +0000
committerSimo Sorce <idra@samba.org>2001-10-03 21:10:29 +0000
commita42efb497153dcca1fad227e28f5eaf41ee943c3 (patch)
treea3a2ea3db448af8624ea6b7cc86094d278dbd95f /source3/nsswitch/winbindd_group.c
parent9d4e919f4a3c901c9e70bd710335f94cc5b726df (diff)
downloadsamba-a42efb497153dcca1fad227e28f5eaf41ee943c3.tar.gz
samba-a42efb497153dcca1fad227e28f5eaf41ee943c3.tar.bz2
samba-a42efb497153dcca1fad227e28f5eaf41ee943c3.zip
fix some possible memleaks and not tested reallocs spotted by Andreas Moroder
(This used to be commit d30939a091b48f4d77f7618c75668ae151a5592e)
Diffstat (limited to 'source3/nsswitch/winbindd_group.c')
-rw-r--r--source3/nsswitch/winbindd_group.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source3/nsswitch/winbindd_group.c b/source3/nsswitch/winbindd_group.c
index 2b567f1336..ab693eff63 100644
--- a/source3/nsswitch/winbindd_group.c
+++ b/source3/nsswitch/winbindd_group.c
@@ -467,7 +467,7 @@ static BOOL get_sam_group_entries(struct getent_state *ent)
{
NTSTATUS status;
uint32 num_entries;
- struct acct_info *name_list = NULL;
+ struct acct_info *name_list = NULL, *tnl;
if (ent->got_all_sam_entries) {
return False;
@@ -510,10 +510,17 @@ static BOOL get_sam_group_entries(struct getent_state *ent)
if (num_entries) {
- name_list = Realloc(name_list,
- sizeof(struct acct_info) *
- (ent->num_sam_entries +
- num_entries));
+ tnl = Realloc(name_list,
+ sizeof(struct acct_info) *
+ (ent->num_sam_entries +
+ num_entries));
+ if(tnl == NULL)
+ {
+ DEBUG(0,("get_sam_group_entries: unable ro realloc a structure!\n"));
+ SAFE_FREE(name_list);
+ return False;
+ }
+ else name_list = tnl;
memcpy(&name_list[ent->num_sam_entries],
sam_grp_entries,