summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/smbd/service.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source4/smbd/service.c b/source4/smbd/service.c
index fac0e175a1..586c05c2c6 100644
--- a/source4/smbd/service.c
+++ b/source4/smbd/service.c
@@ -192,10 +192,14 @@ static int server_destructor(void *ptr)
socket_destroy(conn->socket);
- event_remove_fd(conn->event.ctx, conn->event.fde);
- conn->event.fde = NULL;
- event_remove_timed(conn->event.ctx, conn->event.idle);
- conn->event.idle = NULL;
+ if (conn->event.fde) {
+ event_remove_fd(conn->event.ctx, conn->event.fde);
+ conn->event.fde = NULL;
+ }
+ if (conn->event.idle) {
+ event_remove_timed(conn->event.ctx, conn->event.idle);
+ conn->event.idle = NULL;
+ }
DLIST_REMOVE(conn->server_socket->connection_list, conn);