]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:utils: Fix memory leaks in test_ntlm_in_both()
authorAndreas Schneider <asn@samba.org>
Fri, 25 Oct 2024 05:56:46 +0000 (07:56 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 1 Jul 2025 08:17:30 +0000 (08:17 +0000)
Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x7ff61d8fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7ff61d450c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783
    #2 0x7ff61d452acf in __talloc ../../lib/talloc/talloc.c:825
    #3 0x7ff61d452acf in _talloc_named_const ../../lib/talloc/talloc.c:982
    #4 0x7ff61d452acf in _talloc_array ../../lib/talloc/talloc.c:2784
    #5 0x7ff61c9f6a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58
    #6 0x7ff61c9f6b1b in data_blob_named ../../lib/util/data_blob.c:40
    #7 0x561cafffad96 in test_ntlm_in_both ../../source3/utils/ntlm_auth_diagnostics.c:285
    #8 0x561cafffc8d4 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:714
    #9 0x561cafff8efd in main ../../source3/utils/ntlm_auth.c:2855
    #10 0x7ff61a02a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/utils/ntlm_auth_diagnostics.c

index 1a57f7726f2cf22e6cdf5b09b153bcd4b7ed1a63..fa6b73b7e2c187c827f384be7a1beb61245eca71 100644 (file)
@@ -314,15 +314,12 @@ static bool test_ntlm_in_both(bool lanman_support_expected)
                                              user_session_key,
                                              &authoritative,
                                              &error_string, NULL);
-
-       data_blob_free(&nt_response);
-
        if (!NT_STATUS_IS_OK(nt_status)) {
                d_printf("%s (0x%x)\n",
                         error_string,
                         NT_STATUS_V(nt_status));
-               SAFE_FREE(error_string);
-               return False;
+               pass = false;
+               goto done;
        }
        SAFE_FREE(error_string);
 
@@ -358,6 +355,11 @@ static bool test_ntlm_in_both(bool lanman_support_expected)
        }
 
 
+done:
+       SAFE_FREE(error_string);
+       data_blob_free(&nt_response);
+       data_blob_free(&session_key);
+
         return pass;
 }