Fix memory leak in RDB load
Former-commit-id: 06ad1c15d719a34fed36244b12a593f749bbb8a6
This commit is contained in:
parent
fd375eb95c
commit
d3a69998e4
12
src/rdb.cpp
12
src/rdb.cpp
@ -1545,9 +1545,15 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, robj *key, uint64_t mvcc_tstamp) {
|
|||||||
== NULL) return NULL;
|
== NULL) return NULL;
|
||||||
|
|
||||||
if (rdbtype == RDB_TYPE_ZSET_2) {
|
if (rdbtype == RDB_TYPE_ZSET_2) {
|
||||||
if (rdbLoadBinaryDoubleValue(rdb,&score) == -1) return NULL;
|
if (rdbLoadBinaryDoubleValue(rdb,&score) == -1) {
|
||||||
|
sdsfree(sdsele);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (rdbLoadDoubleValue(rdb,&score) == -1) return NULL;
|
if (rdbLoadDoubleValue(rdb,&score) == -1) {
|
||||||
|
sdsfree(sdsele);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't care about integer-encoded strings. */
|
/* Don't care about integer-encoded strings. */
|
||||||
@ -2181,6 +2187,8 @@ int rdbLoadRio(rio *rdb, rdbSaveInfo *rsi, int loading_aof) {
|
|||||||
decrRefCount(val);
|
decrRefCount(val);
|
||||||
val = nullptr;
|
val = nullptr;
|
||||||
}
|
}
|
||||||
|
decrRefCount(key);
|
||||||
|
key = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the state that is key-specified and is populated by
|
/* Reset the state that is key-specified and is populated by
|
||||||
|
Loading…
x
Reference in New Issue
Block a user