From 1c24cd79cccc55db6424aca348a288ba25b1bf21 Mon Sep 17 00:00:00 2001 From: Liang Zhu Date: Fri, 1 Nov 2024 08:26:05 -0700 Subject: [PATCH] Fix heap corruption when calling ub_ctx_delete in Windows (#1157) --- util/tube.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/tube.c b/util/tube.c index 7d98b93c3..96187e134 100644 --- a/util/tube.c +++ b/util/tube.c @@ -584,7 +584,10 @@ void tube_close_write(struct tube* ATTR_UNUSED(tube)) void tube_remove_bg_listen(struct tube* tube) { verbose(VERB_ALGO, "tube remove_bg_listen"); - ub_winsock_unregister_wsaevent(tube->ev_listen); + if (tube->ev_listen != NULL) { + ub_winsock_unregister_wsaevent(tube->ev_listen); + tube->ev_listen = NULL; + } } void tube_remove_bg_write(struct tube* tube) -- 2.47.2