summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/nxt_router.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c
index 8971fb5b..44dbf200 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -1033,6 +1033,10 @@ nxt_router_listen_socket_close(nxt_task_t *task, void *obj, void *data)
joint = listen->socket.data;
nxt_queue_remove(&listen->link);
+
+ /* 'task' refers to listen->task and we cannot use after nxt_free() */
+ task = &task->thread->engine->task;
+
nxt_free(listen);
nxt_router_listen_socket_release(task, joint);