diff options
author | Andreas Schneider <asn@samba.org> | 2013-02-18 16:36:22 +0100 |
---|---|---|
committer | David Disseldorp <ddiss@suse.de> | 2013-03-05 23:29:11 +0100 |
commit | 14bae61ba36814ea5eca7c51cf1cc039e9e6803f (patch) | |
tree | 4605410a706e9b93b0dd47c47e143c0f007e327a /source3/winbindd/winbindd_util.c | |
parent | e8e3a68729074c9dafb9a41df0ffa3a49c260772 (diff) | |
download | samba-14bae61ba36814ea5eca7c51cf1cc039e9e6803f.tar.gz samba-14bae61ba36814ea5eca7c51cf1cc039e9e6803f.tar.bz2 samba-14bae61ba36814ea5eca7c51cf1cc039e9e6803f.zip |
winbind: Use talloc for allocating domain, dns, forest and dc name.
Reviewed-by: David Disseldorp <ddiss@samba.org>
Diffstat (limited to 'source3/winbindd/winbindd_util.c')
-rw-r--r-- | source3/winbindd/winbindd_util.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index c32feb8951..4759fd5109 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -67,7 +67,7 @@ static void free_domain_list(void) struct winbindd_domain *next = domain->next; DLIST_REMOVE(_domain_list, domain); - SAFE_FREE(domain); + TALLOC_FREE(domain); domain = next; } } @@ -156,27 +156,31 @@ static struct winbindd_domain *add_trusted_domain(const char *domain_name, const } /* Create new domain entry */ - - if ((domain = SMB_MALLOC_P(struct winbindd_domain)) == NULL) + domain = talloc_zero(NULL, struct winbindd_domain); + if (domain == NULL) { return NULL; + } - /* Fill in fields */ - - ZERO_STRUCTP(domain); - - domain->children = SMB_MALLOC_ARRAY( - struct winbindd_child, lp_winbind_max_domain_connections()); + domain->children = talloc_zero_array(domain, + struct winbindd_child, + lp_winbind_max_domain_connections()); if (domain->children == NULL) { - SAFE_FREE(domain); + TALLOC_FREE(domain); + return NULL; + } + + domain->name = talloc_strdup(domain, domain_name); + if (domain->name == NULL) { + TALLOC_FREE(domain); return NULL; } - memset(domain->children, 0, - sizeof(struct winbindd_child) - * lp_winbind_max_domain_connections()); - fstrcpy(domain->name, domain_name); if (alternative_name) { - fstrcpy(domain->alt_name, alternative_name); + domain->alt_name = talloc_strdup(domain, alternative_name); + if (domain->alt_name == NULL) { + TALLOC_FREE(domain); + return NULL; + } } domain->methods = methods; |