summaryrefslogtreecommitdiff
path: root/src/networking.c
diff options
context:
space:
mode:
authorYossi Gottlieb <yossigo@gmail.com>2020-03-22 14:47:44 +0200
committerYossi Gottlieb <yossigo@gmail.com>2020-03-22 14:47:44 +0200
commit2dab5015b79f7fe86c2efb0e4e7f26548c8096c9 (patch)
tree83fb07db563bdf1ec87b2160ee15f37c23f82746 /src/networking.c
parent4c08ae3ff698025b7100648faae5a0ac3f9f31fc (diff)
downloadredis-2dab5015b79f7fe86c2efb0e4e7f26548c8096c9.tar.gz
Fix crashes related to failed/rejected accepts.
Diffstat (limited to 'src/networking.c')
-rw-r--r--src/networking.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/networking.c b/src/networking.c
index 69d59a59b..a550e4040 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -786,7 +786,7 @@ void clientAcceptHandler(connection *conn) {
serverLog(LL_WARNING,
"Error accepting a client connection: %s",
connGetLastError(conn));
- freeClient(c);
+ freeClientAsync(c);
return;
}
@@ -828,7 +828,7 @@ void clientAcceptHandler(connection *conn) {
/* Nothing to do, Just to avoid the warning... */
}
server.stat_rejected_conn++;
- freeClient(c);
+ freeClientAsync(c);
return;
}
}
@@ -887,9 +887,10 @@ static void acceptCommonHandler(connection *conn, int flags, char *ip) {
*/
if (connAccept(conn, clientAcceptHandler) == C_ERR) {
char conninfo[100];
- serverLog(LL_WARNING,
- "Error accepting a client connection: %s (conn: %s)",
- connGetLastError(conn), connGetInfo(conn, conninfo, sizeof(conninfo)));
+ if (connGetState(conn) == CONN_STATE_ERROR)
+ serverLog(LL_WARNING,
+ "Error accepting a client connection: %s (conn: %s)",
+ connGetLastError(conn), connGetInfo(conn, conninfo, sizeof(conninfo)));
freeClient(connGetPrivateData(conn));
return;
}