Fix leak when tombstone exists

Former-commit-id: 3d0ccdf6d2ddc523a3532c46cf905023d207b8cb
This commit is contained in:
John Sully 2020-02-16 03:36:47 -05:00
parent 3b496ea282
commit 00f80cce27

View File

@ -412,7 +412,9 @@ bool redisDbPersistentData::syncDelete(robj *key)
auto itr = m_pdbSnapshot->find_cached_threadsafe(szFromObj(key)); auto itr = m_pdbSnapshot->find_cached_threadsafe(szFromObj(key));
if (itr != nullptr) if (itr != nullptr)
{ {
dictAdd(m_pdictTombstone, sdsdup(szFromObj(key)), nullptr); sds keyTombstone = sdsdup(szFromObj(key));
if (dictAdd(m_pdictTombstone, keyTombstone, nullptr) != DICT_OK)
sdsfree(keyTombstone);
} }
} }
if (g_pserver->cluster_enabled) slotToKeyDel(key); if (g_pserver->cluster_enabled) slotToKeyDel(key);