From: Andreas Schneider Date: Thu, 22 Dec 2022 09:31:11 +0000 (+0100) Subject: s3:client: Fix a use-after-free issue in smbclient X-Git-Tag: samba-4.16.9~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78848f21a3ecefdc6689c2794b166981eb517205;p=thirdparty%2Fsamba.git s3:client: Fix a use-after-free issue in smbclient Detected by make test TESTS="samba3.blackbox.chdir-cache" with an optimized build or with AddressSanitizer. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15268 Signed-off-by: Andreas Schneider Reviewed-by: Ralph Boehme (cherry picked from commit 9c707b4be27e2a6f79886d3ec8b5066c922b99bd) Autobuild-User(v4-16-test): Jule Anger Autobuild-Date(v4-16-test): Tue Jan 3 19:19:57 UTC 2023 on sn-devel-184 --- diff --git a/source3/client/client.c b/source3/client/client.c index 69b7c9022c2..607be92bba3 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -5126,10 +5126,11 @@ static int cmd_tcon(void) return -1; } - talloc_free(sharename); - d_printf("tcon to %s successful, tid: %u\n", sharename, cli_state_get_tid(cli)); + + talloc_free(sharename); + return 0; }