From 96be5f6a6c7a6787d4864a1d555ed98f09f6cad2 Mon Sep 17 00:00:00 2001 From: John Sully Date: Thu, 19 Mar 2020 14:34:23 -0400 Subject: [PATCH] Prevent dangling lock when we can't free the client Former-commit-id: 3c373494d63b21744b264f0a47e6999bcdda6b2b --- src/networking.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/networking.cpp b/src/networking.cpp index 58bd79bcc..f6425af60 100644 --- a/src/networking.cpp +++ b/src/networking.cpp @@ -1630,10 +1630,13 @@ void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask) { if (writeToClient(fd,c,1) == C_ERR) { AeLocker ae; - c->lock.lock(); + c->lock(); ae.arm(c); if (c->flags & CLIENT_CLOSE_ASAP) - freeClient(c); + { + if (!freeClient(c)) + c->unlock(); + } } }