mirror of
http://github.com/valkey-io/valkey
synced 2024-11-22 00:52:38 +00:00
Lazyfree: avoid memory leak when free slowlog entry
This commit is contained in:
parent
79567b6e66
commit
368124e8fa
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user