]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:auth: Fix leaks
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Sun, 3 Sep 2023 22:02:41 +0000 (10:02 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Sep 2023 21:35:29 +0000 (21:35 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/auth/sam.c

index 916899c6d9370cbdf54b262b3c1b048d70966852..7b1d29e377e314e5a30129650fda99bb35119505 100644 (file)
@@ -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;
        }