]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: Fix memory leak
authorAndreas Schneider <asn@samba.org>
Thu, 1 Aug 2024 07:32:49 +0000 (09:32 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 1 Aug 2024 16:55:43 +0000 (16:55 +0000)
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 <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Aug  1 16:55:43 UTC 2024 on atb-devel-224

source4/torture/smbtorture.c

index 0aa5eaee9a27a40cd5f8110b20311f995e81ced5..7c5a6f78dbbcd28c64d9ae8c63c6047266d6a822 100644 (file)
@@ -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;