Fix memory leak of ReplicaNestState on shutdown

Former-commit-id: 4781eda7225c2640e25387663c33ef74cd98b0c4
This commit is contained in:
John Sully 2020-02-16 03:43:29 -05:00
parent 5f2e509129
commit 5780020388

View File

@ -3371,7 +3371,7 @@ private:
redisMaster *m_mi = nullptr;
};
static thread_local ReplicaNestState *s_pstate = nullptr;
static thread_local std::unique_ptr<ReplicaNestState> s_pstate;
bool FInReplicaReplay()
{
@ -3384,7 +3384,7 @@ static std::unordered_map<std::string, uint64_t> g_mapmvcc;
void replicaReplayCommand(client *c)
{
if (s_pstate == nullptr)
s_pstate = new (MALLOC_LOCAL) ReplicaNestState;
s_pstate = std::make_unique<ReplicaNestState>();
// the replay command contains two arguments:
// 1: The UUID of the source