Commit 269760ed authored by zhaozhao.zz's avatar zhaozhao.zz
Browse files

Lazyfree: avoid memory leak when free slowlog entry

parent bb3b5ddd
......@@ -72,9 +72,12 @@ slowlogEntry *slowlogCreateEntry(client *c, robj **argv, int argc, long long dur
(unsigned long)
sdslen(argv[j]->ptr) - SLOWLOG_ENTRY_MAX_STRING);
se->argv[j] = createObject(OBJ_STRING,s);
} else {
} else if (argv[j]->refcount == OBJ_SHARED_REFCOUNT) {
se->argv[j] = argv[j];
incrRefCount(argv[j]);
} else {
/* Duplicate a string object,
* avoid memory leak for lazyfree. */
se->argv[j] = dupStringObject(argv[j]);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment