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
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;
/* 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, ×up);
+ te = tevent_add_timer(tctx->ev, mem_ctx, ne, timeout_cb, ×up);
if (te == NULL) {
torture_comment(tctx, "Failed to add timer.");
goto done;