Skip to content

Commit 2585f60

Browse files
charsyamhpatro
andauthored
Fix RDB expiry write length and leak when loading zipmap (valkey-io#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>
1 parent 034d16a commit 2585f60

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/rdb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ ssize_t rdbSaveObject(rio *rdb, robj *o, robj *key, int dbid, unsigned char rdbt
10181018
nwritten += n;
10191019
if (add_expiry) {
10201020
long long expiry = entryGetExpiry(next);
1021-
if ((n = rdbSaveMillisecondTime(rdb, expiry) == -1)) {
1021+
if ((n = rdbSaveMillisecondTime(rdb, expiry)) == -1) {
10221022
hashtableCleanupIterator(&iter);
10231023
return -1;
10241024
}
@@ -2414,6 +2414,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int dbid, int *error, int rd
24142414
hashtableRelease(dupSearchHashtable);
24152415
sdsfree(field);
24162416
zfree(encoded);
2417+
zfree(lp);
24172418
objectSetVal(o, NULL);
24182419
decrRefCount(o);
24192420
return NULL;

0 commit comments

Comments
 (0)