diff options
author | Jeremy Allison <jra@samba.org> | 2001-08-18 19:57:41 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-08-18 19:57:41 +0000 |
commit | edefe857bd2e16042c97e2321531ddc6cc25b51f (patch) | |
tree | 180df80b3530e2ce4f5b57eb1ce030919c5c6844 /source/nsswitch/winbindd_misc.c | |
parent | a6785bac152bf03db3670f6372b37f4cd5f9fd7a (diff) | |
download | samba-edefe857bd2e16042c97e2321531ddc6cc25b51f.tar.gz samba-edefe857bd2e16042c97e2321531ddc6cc25b51f.tar.xz samba-edefe857bd2e16042c97e2321531ddc6cc25b51f.zip |
More Realloc fixes.
Jeremy.
Diffstat (limited to 'source/nsswitch/winbindd_misc.c')
-rw-r--r-- | source/nsswitch/winbindd_misc.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/nsswitch/winbindd_misc.c b/source/nsswitch/winbindd_misc.c index 9520fc218b3..7a3003d0307 100644 --- a/source/nsswitch/winbindd_misc.c +++ b/source/nsswitch/winbindd_misc.c @@ -136,7 +136,7 @@ enum winbindd_result winbindd_list_trusted_domains(struct winbindd_cli_state { struct winbindd_domain *domain; int total_entries = 0, extra_data_len = 0; - char *extra_data = NULL; + char *ted, *extra_data = NULL; DEBUG(3, ("[%5d]: list trusted domains\n", state->pid)); @@ -149,10 +149,16 @@ enum winbindd_result winbindd_list_trusted_domains(struct winbindd_cli_state /* Add domain to list */ total_entries++; - extra_data = Realloc(extra_data, sizeof(fstring) * + ted = Realloc(extra_data, sizeof(fstring) * total_entries); - if (!extra_data) return WINBINDD_ERROR; + if (!ted) { + DEBUG(0,("winbindd_list_trusted_domains: failed to enlarge buffer!\n")); + if (extra_data) + free(extra_data); + return WINBINDD_ERROR; + } else + extra_data = ted; memcpy(&extra_data[extra_data_len], domain->name, strlen(domain->name)); |