From 877868beccb2fdb7cf924ac62bd8444ae647bc88 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Thu, 16 Jul 2015 13:09:18 +0200 Subject: [PATCH] Control socket fix --- src/control_socket.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/control_socket.cpp b/src/control_socket.cpp index 856ac9d43..e8a6d9d4d 100644 --- a/src/control_socket.cpp +++ b/src/control_socket.cpp @@ -595,12 +595,13 @@ static void * control_thread(void *args) if(ret <= 0) { struct client *next; CLOSESOCKET(cur->fd); - if(cur->prev) { + if (cur->prev) { cur->prev->next = cur->next; - cur->next->prev = cur->prev; } else { clients = cur->next; - clients->prev = NULL; + } + if (cur->next) { + cur->next->prev = cur->prev; } next = cur->next; free(cur);