diff options
author | Volker Lendecke <vl@samba.org> | 2018-04-06 11:04:24 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-04-07 02:11:20 +0200 |
commit | e29eaa43f511750cc1670b7154ef936496b46a39 (patch) | |
tree | 485b8d9c2f517824bf88944ee8736d5472e89c9b | |
parent | ad90835c2bdf954622935139ec64ce640aa49b4b (diff) | |
download | samba-e29eaa43f511750cc1670b7154ef936496b46a39.tar.gz |
idmap: Fix CID 1363261 Resource leak
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/winbindd/idmap_ad_nss.c | 6 |
1 files changed, 4 insertions, 2 deletions
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); |