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:
charsyam
2026-04-07 21:56:30 +09:00
committed by GitHub
parent 034d16ac44
commit 2585f60ebc
+2 -1
View File
@@ -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;