]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:utils: Fix memory leaks in test_ntlm_in_lm()
authorAndreas Schneider <asn@samba.org>
Mon, 28 Oct 2024 12:41:01 +0000 (13:41 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 1 Jul 2025 08:17:30 +0000 (08:17 +0000)
Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x7f597eefc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7f597eae3c57 in __talloc_with_prefix ../../lib/talloc/talloc.c:783
    #2 0x7f597eae5acf in __talloc ../../lib/talloc/talloc.c:825
    #3 0x7f597eae5acf in _talloc_named_const ../../lib/talloc/talloc.c:982
    #4 0x7f597eae5acf in _talloc_array ../../lib/talloc/talloc.c:2784
    #5 0x7f597e865a99 in data_blob_talloc_named ../../lib/util/data_blob.c:58
    #6 0x7f597e865b1b in data_blob_named ../../lib/util/data_blob.c:40
    #7 0x55a95a1a389c in get_challenge ../../source3/utils/ntlm_auth.c:375
    #8 0x55a95a1aa724 in test_ntlm_in_lm ../../source3/utils/ntlm_auth_diagnostics.c:203
    #9 0x55a95a1ab947 in diagnose_ntlm_auth ../../source3/utils/ntlm_auth_diagnostics.c:721
    #10 0x55a95a1a7efd in main ../../source3/utils/ntlm_auth.c:2855
    #11 0x7f597b62a2ad 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 3228476ee4d7278d142ab228c28eb2392e10e2c6..d70c8c458832e1aaf1c0aa84facf9d8d95f7ebf5 100644 (file)
@@ -221,15 +221,12 @@ static bool test_ntlm_in_lm(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);
 
@@ -270,6 +267,11 @@ static bool test_ntlm_in_lm(bool lanman_support_expected)
                        pass = False;
                }
        }
+
+done:
+       data_blob_free(&nt_response);
+       SAFE_FREE(error_string);
+
         return pass;
 }