From: Samuel Cabrero Date: Mon, 13 Jun 2022 15:03:01 +0000 (+0200) Subject: s3:libads: Allocate ads->auth.kdc_server under ADS_STRUCT talloc context X-Git-Tag: tevent-0.13.0~235 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca7ac79faefc92c5fb9cdc7acf14bd0d401b0d14;p=thirdparty%2Fsamba.git s3:libads: Allocate ads->auth.kdc_server under ADS_STRUCT talloc context Signed-off-by: Samuel Cabrero Reviewed-by: Jeremy Allison --- diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c index 00134d1a73c..e4739d7fd11 100644 --- a/source3/libads/ads_struct.c +++ b/source3/libads/ads_struct.c @@ -130,7 +130,6 @@ static void ads_destroy(ADS_STRUCT **ads) #ifdef HAVE_LDAP ads_disconnect(*ads); #endif - SAFE_FREE((*ads)->auth.kdc_server); SAFE_FREE((*ads)->auth.ccache_name); SAFE_FREE((*ads)->config.realm); diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 00a3c80c60f..5ac5b1b0e12 100755 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -733,7 +733,11 @@ got_connection: if (!ads->auth.kdc_server) { print_sockaddr(addr, sizeof(addr), &ads->ldap.ss); - ads->auth.kdc_server = SMB_STRDUP(addr); + ads->auth.kdc_server = talloc_strdup(ads, addr); + if (ads->auth.kdc_server == NULL) { + status = ADS_ERROR_NT(NT_STATUS_NO_MEMORY); + goto out; + } } /* If the caller() requested no LDAP bind, then we are done */