From 5780020388b993e4906b59761fc063a3f050683d Mon Sep 17 00:00:00 2001 From: John Sully Date: Sun, 16 Feb 2020 03:43:29 -0500 Subject: [PATCH] Fix memory leak of ReplicaNestState on shutdown Former-commit-id: 4781eda7225c2640e25387663c33ef74cd98b0c4 --- src/replication.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/replication.cpp b/src/replication.cpp index 9b8570c49..ba2008c0a 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -3371,7 +3371,7 @@ private: redisMaster *m_mi = nullptr; }; -static thread_local ReplicaNestState *s_pstate = nullptr; +static thread_local std::unique_ptr s_pstate; bool FInReplicaReplay() { @@ -3384,7 +3384,7 @@ static std::unordered_map g_mapmvcc; void replicaReplayCommand(client *c) { if (s_pstate == nullptr) - s_pstate = new (MALLOC_LOCAL) ReplicaNestState; + s_pstate = std::make_unique(); // the replay command contains two arguments: // 1: The UUID of the source