diff --git a/src/apps/relay/ns_ioalib_engine_impl.c b/src/apps/relay/ns_ioalib_engine_impl.c index cb7fcd6..803625c 100644 --- a/src/apps/relay/ns_ioalib_engine_impl.c +++ b/src/apps/relay/ns_ioalib_engine_impl.c @@ -1492,6 +1492,12 @@ void close_ioa_socket(ioa_socket_handle s) { close_socket_net_data(s); + if (s->session && s->session->client_socket == s) { + // Detaching client socket from super session to prevent mem corruption + // in case client_to_be_allocated_timeout_handler gets triggered + s->session->client_socket = NULL; + } + s->session = NULL; s->sub_session = NULL; s->magic = 0;