summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2022-11-30 18:23:17 +0100
committerAndreas Schneider <asn@cryptomilk.org>2022-12-01 15:03:19 +0000
commit49b40a1334353aec6febc82a09a49a7e9588e65c (patch)
tree8148c055d6bb2d4f919166d84d945e955d821de2
parent357bafe62584e2ca1bbf0dfaf6f949262daf59dc (diff)
downloadsamba-49b40a1334353aec6febc82a09a49a7e9588e65c.tar.gz
s4:torture: Fix segfault in multichannel test
The timer for the timeout_cb() handler was created on a memory context which doesn't get freed, so the timer was still valid when running the next test and fired there. It was then writing into random memory leading to segfaults. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Dec 1 15:03:19 UTC 2022 on sn-devel-184
-rw-r--r--source4/torture/smb2/multichannel.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/source4/torture/smb2/multichannel.c b/source4/torture/smb2/multichannel.c
index 24c736d6701..0c0bc5d1a7e 100644
--- a/source4/torture/smb2/multichannel.c
+++ b/source4/torture/smb2/multichannel.c
@@ -1862,7 +1862,6 @@ static bool test_multichannel_lease_break_test3(struct torture_context *tctx,
struct tevent_timer *te = NULL;
struct timeval ne;
bool timesup = false;
- TALLOC_CTX *tmp_ctx = talloc_new(NULL);
if (!test_multichannel_initial_checks(tctx, tree1)) {
return true;
@@ -1914,7 +1913,7 @@ static bool test_multichannel_lease_break_test3(struct torture_context *tctx,
/* Set a timeout for 5 seconds for session 1 to open file1 */
ne = tevent_timeval_current_ofs(0, 5000000);
- te = tevent_add_timer(tctx->ev, tmp_ctx, ne, timeout_cb, &timesup);
+ te = tevent_add_timer(tctx->ev, mem_ctx, ne, timeout_cb, &timesup);
if (te == NULL) {
torture_comment(tctx, "Failed to add timer.");
goto done;