summaryrefslogtreecommitdiff
path: root/src/rdb.c
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2019-10-24 09:45:25 +0300
committerOran Agra <oran@redislabs.com>2019-10-24 09:45:25 +0300
commitbe352633a07552d0c3893ffa096b3732347ea378 (patch)
tree07a1bd1a060291b5105f7ca2f2e2f5f0f5fec5f8 /src/rdb.c
parent673c9d702962a5618650108eaf4c5f38bcafe164 (diff)
downloadredis-be352633a07552d0c3893ffa096b3732347ea378.tar.gz
Make module tests pass with valgrind, and fix a leak in diskless load
Diffstat (limited to 'src/rdb.c')
-rw-r--r--src/rdb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rdb.c b/src/rdb.c
index 2406ea88a..cbaa428a1 100644
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -2172,7 +2172,11 @@ int rdbLoadRio(rio *rdb, rdbSaveInfo *rsi, int loading_aof) {
/* Read key */
if ((key = rdbLoadStringObject(rdb)) == NULL) goto eoferr;
/* Read value */
- if ((val = rdbLoadObject(type,rdb,key)) == NULL) goto eoferr;
+ if ((val = rdbLoadObject(type,rdb,key)) == NULL) {
+ decrRefCount(key);
+ goto eoferr;
+ }
+
/* Check if the key already expired. This function is used when loading
* an RDB file from disk, either at startup, or when an RDB was
* received from the master. In the latter case, the master is