mirror of
https://github.com/valkey-io/valkey.git
synced 2026-05-06 13:36:47 -04:00
Fix RDB expiry write length and leak when loading zipmap (#3422)
Fix two things: 1. Incorrect RDB object size reported when writing hash fields with expiration, because of wrong position of parentheses. Affects the serialized size reported in DEBUG OBJECT. 2. Memory leak when loading a zipmap (only used in really old RDB versions). Signed-off-by: charsyam <charsyam@naver.com> Co-authored-by: Harkrishn Patro <bunty.hari@gmail.com>
This commit is contained in:
@@ -1018,7 +1018,7 @@ ssize_t rdbSaveObject(rio *rdb, robj *o, robj *key, int dbid, unsigned char rdbt
|
||||
nwritten += n;
|
||||
if (add_expiry) {
|
||||
long long expiry = entryGetExpiry(next);
|
||||
if ((n = rdbSaveMillisecondTime(rdb, expiry) == -1)) {
|
||||
if ((n = rdbSaveMillisecondTime(rdb, expiry)) == -1) {
|
||||
hashtableCleanupIterator(&iter);
|
||||
return -1;
|
||||
}
|
||||
@@ -2414,6 +2414,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int dbid, int *error, int rd
|
||||
hashtableRelease(dupSearchHashtable);
|
||||
sdsfree(field);
|
||||
zfree(encoded);
|
||||
zfree(lp);
|
||||
objectSetVal(o, NULL);
|
||||
decrRefCount(o);
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user