From: Andreas Schneider Date: Thu, 1 Aug 2024 07:32:49 +0000 (+0200) Subject: s4:torture: Fix memory leak X-Git-Tag: tdb-1.4.12~44 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=48963251fb04cce4d081408857c0c3a0f6861f4c;p=thirdparty%2Fsamba.git s4:torture: Fix memory leak Direct leak of 102 byte(s) in 1 object(s) allocated from: #0 0x7f35322fc7d7 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69 #1 0x7f3531e43bc2 in __talloc_with_prefix ../../lib/talloc/talloc.c:783 #2 0x7f3531e45034 in __talloc ../../lib/talloc/talloc.c:825 #3 0x7f3531e45034 in __talloc_strlendup ../../lib/talloc/talloc.c:2454 #4 0x7f3531e45034 in talloc_strdup ../../lib/talloc/talloc.c:2470 #5 0x7f352f90264b in smbcli_parse_unc ../../source4/libcli/cliconnect.c:269 #6 0x55fbf83aa207 in torture_parse_target ../../source4/torture/smbtorture.c:192 #7 0x55fbf83ae031 in main ../../source4/torture/smbtorture.c:744 #8 0x7f352ca2a1ef in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 Signed-off-by: Andreas Schneider Reviewed-by: Volker Lendecke Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Thu Aug 1 16:55:43 UTC 2024 on atb-devel-224 --- diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index 0aa5eaee9a2..7c5a6f78dbb 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -189,7 +189,7 @@ bool torture_parse_target(TALLOC_CTX *ctx, NTSTATUS status; /* see if its a RPC transport specifier */ - if (!smbcli_parse_unc(target, NULL, &host, &share)) { + if (!smbcli_parse_unc(target, ctx, &host, &share)) { const char *h; status = dcerpc_parse_binding(ctx, target, &binding_struct); @@ -211,6 +211,9 @@ bool torture_parse_target(TALLOC_CTX *ctx, lpcfg_set_cmdline(lp_ctx, "torture:host", host); lpcfg_set_cmdline(lp_ctx, "torture:share", share); lpcfg_set_cmdline(lp_ctx, "torture:binding", host); + + TALLOC_FREE(host); + TALLOC_FREE(share); } return true;