From: Joseph Sutton Date: Sun, 3 Sep 2023 22:02:41 +0000 (+1200) Subject: s4:auth: Fix leaks X-Git-Tag: tevent-0.16.0~604 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4933dd4b771a3cbd29bf430c319b06f2c067d0f;p=thirdparty%2Fsamba.git s4:auth: Fix leaks Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/source4/auth/sam.c b/source4/auth/sam.c index 916899c6d93..7b1d29e377e 100644 --- a/source4/auth/sam.c +++ b/source4/auth/sam.c @@ -735,10 +735,12 @@ _PUBLIC_ NTSTATUS authsam_update_user_info_dc(TALLOC_CTX *mem_ctx, &user_info_dc->sids, &user_info_dc->num_sids); if (!NT_STATUS_IS_OK(status)) { + talloc_free(filter); return status; } } + talloc_free(filter); return NT_STATUS_OK; } @@ -898,6 +900,7 @@ NTSTATUS authsam_get_user_info_dc_principal(TALLOC_CTX *mem_ctx, nt_status = dom_sid_split_rid(tmp_ctx, user_sid, &domain_sid, NULL); if (!NT_STATUS_IS_OK(nt_status)) { + talloc_free(tmp_ctx); return nt_status; } @@ -908,10 +911,12 @@ NTSTATUS authsam_get_user_info_dc_principal(TALLOC_CTX *mem_ctx, struct dom_sid_buf buf; DEBUG(3, ("authsam_get_user_info_dc_principal: Failed to find domain with: SID %s\n", dom_sid_str_buf(domain_sid, &buf))); + talloc_free(tmp_ctx); return NT_STATUS_NO_SUCH_USER; } } else { + talloc_free(tmp_ctx); return NT_STATUS_INVALID_PARAMETER; } @@ -1581,6 +1586,7 @@ NTSTATUS authsam_logon_success_accounting(struct ldb_context *sam_ctx, status = authsam_check_bad_password_indicator( sam_ctx, mem_ctx, &need_db_reread, msg); if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(mem_ctx); return status; }