summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2019-10-28 10:05:52 +0100
committerGitHub <noreply@github.com>2019-10-28 10:05:52 +0100
commitc328c807e7cef76db0fcf6fc2a58f62349489458 (patch)
treec6a76a5daecba3fef112aa3bab203d78f81388c4 /src
parentd2658f83879e80574cb9541cdb50163da24d0782 (diff)
parentbe352633a07552d0c3893ffa096b3732347ea378 (diff)
downloadredis-c328c807e7cef76db0fcf6fc2a58f62349489458.tar.gz
Merge pull request #6496 from oranagra/module_tests_valgrind
Make module tests pass with valgrind, and fix a leak in diskless load
Diffstat (limited to 'src')
-rw-r--r--src/rdb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rdb.c b/src/rdb.c
index c92b9f4a1..f530219a4 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