diff options
author | Andreas Schneider <asn@samba.org> | 2022-03-15 12:56:58 +0100 |
---|---|---|
committer | Jule Anger <janger@samba.org> | 2022-03-17 09:14:56 +0000 |
commit | 3c98408be7ddfe1d3df45b4790746eb608c2b98d (patch) | |
tree | f0ad99c6ed23444d4e513249c804e51f5d76327c | |
parent | cfbd47d7b48896847cd43da58167cd6afcbef31e (diff) | |
download | samba-3c98408be7ddfe1d3df45b4790746eb608c2b98d.tar.gz |
s3:libads: Allocate all memory on the talloc stackframe
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15016
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 652c8ce1672dfead00c7af6af22e3bb3927764ec)
-rw-r--r-- | source3/libads/kerberos.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c index d1c410ffa4b..aadc65a3edc 100644 --- a/source3/libads/kerberos.c +++ b/source3/libads/kerberos.c @@ -438,7 +438,7 @@ static char *get_kdc_ip_string(char *mem_ctx, SMB_ASSERT(pss != NULL); - kdc_str = talloc_asprintf(mem_ctx, + kdc_str = talloc_asprintf(frame, "\t\tkdc = %s\n", print_canonical_sockaddr_with_port(mem_ctx, pss)); @@ -459,7 +459,7 @@ static char *get_kdc_ip_string(char *mem_ctx, */ if (sitename) { - status = get_kdc_list(talloc_tos(), + status = get_kdc_list(frame, realm, sitename, &ip_sa_site, @@ -477,7 +477,7 @@ static char *get_kdc_ip_string(char *mem_ctx, /* Get all KDC's. */ - status = get_kdc_list(talloc_tos(), + status = get_kdc_list(frame, realm, NULL, &ip_sa_nonsite, @@ -589,7 +589,7 @@ static char *get_kdc_ip_string(char *mem_ctx, kdc_str = new_kdc_str; } - result = kdc_str; + result = talloc_move(mem_ctx, &kdc_str); out: if (result != NULL) { DBG_DEBUG("Returning\n%s\n", kdc_str); @@ -597,8 +597,6 @@ out: DBG_NOTICE("Failed to get KDC ip address\n"); } - TALLOC_FREE(ip_sa_site); - TALLOC_FREE(ip_sa_nonsite); TALLOC_FREE(frame); return result; } |