Fix memory leak in RDB load
Former-commit-id: 4e9d2f08b11cc76bb2716514fa6d55f76160fd13
This commit is contained in:
parent
873d5537e8
commit
3de971b10c
12
src/rdb.cpp
12
src/rdb.cpp
@ -1597,9 +1597,15 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, robj *key, uint64_t mvcc_tstamp) {
|
||||
== NULL) return NULL;
|
||||
|
||||
if (rdbtype == RDB_TYPE_ZSET_2) {
|
||||
if (rdbLoadBinaryDoubleValue(rdb,&score) == -1) return NULL;
|
||||
if (rdbLoadBinaryDoubleValue(rdb,&score) == -1) {
|
||||
sdsfree(sdsele);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
if (rdbLoadDoubleValue(rdb,&score) == -1) return NULL;
|
||||
if (rdbLoadDoubleValue(rdb,&score) == -1) {
|
||||
sdsfree(sdsele);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't care about integer-encoded strings. */
|
||||
@ -2403,6 +2409,8 @@ int rdbLoadRio(rio *rdb, int rdbflags, rdbSaveInfo *rsi) {
|
||||
decrRefCount(val);
|
||||
val = nullptr;
|
||||
}
|
||||
decrRefCount(key);
|
||||
key = nullptr;
|
||||
}
|
||||
if (g_pserver->key_load_delay)
|
||||
usleep(g_pserver->key_load_delay);
|
||||
|
Loading…
x
Reference in New Issue
Block a user