From 589e95e0c8cced91247b7a3df069a779893544af Mon Sep 17 00:00:00 2001 From: John Sully Date: Sat, 29 May 2021 01:07:46 +0000 Subject: [PATCH] Don't have dangling expires Former-commit-id: 83c8977033d79b6ec69e677dff19f68df53535be --- src/lazyfree.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lazyfree.cpp b/src/lazyfree.cpp index a8f84c0cb..9e997ab57 100644 --- a/src/lazyfree.cpp +++ b/src/lazyfree.cpp @@ -152,6 +152,13 @@ int dbAsyncDelete(redisDb *db, robj *key) { if (de) { robj *val = (robj*)dictGetVal(de); + if (val->FExpires()) + { + /* Deleting an entry from the expires dict will not free the sds of + * the key, because it is shared with the main dictionary. */ + removeExpireCore(db,key,de); + } + /* Tells the module that the key has been unlinked from the database. */ moduleNotifyKeyUnlink(key,val);