Fix crash setting expire on a key with an existing subkey expiration

Former-commit-id: 4858fd893c8e638b0efdcd3ab2c6dc188a6dc6bd
This commit is contained in:
John Sully 2019-07-29 17:09:51 -04:00
parent 945a7b69f1
commit f8884fed3a

View File

@ -801,7 +801,8 @@ public:
void expireSubKey(const char *szSubkey, long long when)
{
auto itrInsert = std::lower_bound(m_vecexpireEntries.begin(), m_vecexpireEntries.end(), when);
m_vecexpireEntries.emplace(itrInsert, when, sdsdup(szSubkey));
const char *subkey = (szSubkey) ? sdsdup(szSubkey) : nullptr;
m_vecexpireEntries.emplace(itrInsert, when, subkey);
}
bool FEmpty() const noexcept { return m_vecexpireEntries.empty(); }