]> git.saurik.com Git - redis.git/blobdiff - src/redis.c
volatile-lru maxmemory policy segfault fixed, thanks to Anthony Lauzon for reporting...
[redis.git] / src / redis.c
index fe656de9b0c941565980dd0cc32aa99b0431fd8b..cf5673a3aa4ce7e9276ba4feffe98e1c93c3edee 100644 (file)
@@ -1372,6 +1372,10 @@ void freeMemoryIfNeeded(void) {
 
                     de = dictGetRandomKey(dict);
                     thiskey = dictGetEntryKey(de);
+                    /* When policy is volatile-lru we need an additonal lookup
+                     * to locate the real key, as dict is set to db->expires. */
+                    if (server.maxmemory_policy == REDIS_MAXMEMORY_VOLATILE_LRU)
+                        de = dictFind(db->dict, thiskey);
                     o = dictGetEntryVal(de);
                     thisval = estimateObjectIdleTime(o);