From cd6005c86f1bfd15cf07e0b8c310b36cde78acc2 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka <valenok@gmail.com> Date: Wed, 28 Aug 2013 09:54:00 +0100 Subject: [PATCH] Calling thread_stop() before free-ing conn --- mongoose.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mongoose.c b/mongoose.c index b31c57642..efb3441cb 100644 --- a/mongoose.c +++ b/mongoose.c @@ -5164,12 +5164,11 @@ static void *worker_thread(void *thread_func_param) { close_connection(conn); } - free(conn); - if (ctx->callbacks.thread_stop != NULL) { ctx->callbacks.thread_stop(&conn->request_info.user_data, - &conn->request_info.conn_data); + &conn->request_info.conn_data); } + free(conn); } // Signal master that we're done with connection and exiting -- GitLab