From ca7ac79faefc92c5fb9cdc7acf14bd0d401b0d14 Mon Sep 17 00:00:00 2001 From: Samuel Cabrero Date: Mon, 13 Jun 2022 17:03:01 +0200 Subject: s3:libads: Allocate ads->auth.kdc_server under ADS_STRUCT talloc context Signed-off-by: Samuel Cabrero Reviewed-by: Jeremy Allison --- source3/libads/ads_struct.c | 1 - source3/libads/ldap.c | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'source3/libads') 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 */ -- cgit v1.2.1