From: Volker Lendecke Date: Fri, 6 Apr 2018 09:04:24 +0000 (+0200) Subject: idmap: Fix CID 1363261 Resource leak X-Git-Tag: ldb-1.4.0~673 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e29eaa43f511750cc1670b7154ef936496b46a39;p=thirdparty%2Fsamba.git idmap: Fix CID 1363261 Resource leak Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/winbindd/idmap_ad_nss.c b/source3/winbindd/idmap_ad_nss.c index 8e960b8a21e..0fd2b51e156 100644 --- a/source3/winbindd/idmap_ad_nss.c +++ b/source3/winbindd/idmap_ad_nss.c @@ -290,7 +290,7 @@ static NTSTATUS nss_ad_map_from_alias( TALLOC_CTX *mem_ctx, LDAPMessage *msg = NULL; ADS_STATUS ads_status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL); NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL; - char *username; + char *username = NULL; struct idmap_domain *dom; struct idmap_ad_context *ctx = NULL; @@ -339,7 +339,8 @@ static NTSTATUS nss_ad_map_from_alias( TALLOC_CTX *mem_ctx, username = ads_pull_string(ctx->ads, mem_ctx, msg, "sAMAccountName"); if (!username) { - return NT_STATUS_OBJECT_NAME_NOT_FOUND; + nt_status = NT_STATUS_OBJECT_NAME_NOT_FOUND; + goto done; } *name = talloc_asprintf(mem_ctx, "%s\\%s", @@ -353,6 +354,7 @@ static NTSTATUS nss_ad_map_from_alias( TALLOC_CTX *mem_ctx, nt_status = NT_STATUS_OK; done: + TALLOC_FREE(username); TALLOC_FREE(filter); if (msg) { ads_msgfree(ctx->ads, msg);