From: Andreas Schneider Date: Mon, 28 Oct 2024 12:41:01 +0000 (+0100) Subject: s3:utils: Fix memory leaks in test_ntlm_in_lm() X-Git-Tag: tdb-1.4.14~145 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=7754b1e0a3f8cfbd4ae6104bdb8bcbf0293b3459;p=thirdparty%2Fsamba.git s3:utils: Fix memory leaks in test_ntlm_in_lm() 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 Reviewed-by: Noel Power --- diff --git a/source3/utils/ntlm_auth_diagnostics.c b/source3/utils/ntlm_auth_diagnostics.c index 3228476ee4d..d70c8c45883 100644 --- a/source3/utils/ntlm_auth_diagnostics.c +++ b/source3/utils/ntlm_auth_diagnostics.c @@ -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; }