From 1810f8af3587b9f313c5a9cf551b1b359a4f1d1e Mon Sep 17 00:00:00 2001 From: John Sully Date: Sun, 21 Aug 2022 22:35:08 +0000 Subject: [PATCH] Fix a race when undoConnectWithMaster changes mi->repl_transfer_s but the connection is not yet closed and the event handler runs --- src/replication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/replication.cpp b/src/replication.cpp index 0ef43485b..3b8b6f9e1 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -2980,7 +2980,7 @@ void readSyncBulkPayload(connection *conn) { rdbSaveInfo rsi; redisMaster *mi = (redisMaster*)connGetPrivateData(conn); static int usemark = 0; - if (mi == nullptr) { + if (mi == nullptr || conn != mi->repl_transfer_s) { // We're about to be free'd so bail out return; }