diff options
author | antirez <antirez@gmail.com> | 2016-07-06 19:05:44 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2016-07-06 19:06:22 +0200 |
commit | eee878cbc5c6c02e2e3e4073d71de2c970305676 (patch) | |
tree | 774e963ed852e8a646ae660ffee5c065525bb2ae | |
parent | 24882e31f2fd52a2750a1953a5e479576e392ee1 (diff) | |
download | redis-eee878cbc5c6c02e2e3e4073d71de2c970305676.tar.gz |
redis_check_rdb_main(): create shared objects only if needed.
Otherwise Valgrind will complain a memory leak under certain tests where
RDB checking is invoked from within Redis.
-rw-r--r-- | src/redis-check-rdb.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/redis-check-rdb.c b/src/redis-check-rdb.c index 8da860a08..53fb67b80 100644 --- a/src/redis-check-rdb.c +++ b/src/redis-check-rdb.c @@ -332,7 +332,11 @@ int redis_check_rdb_main(int argc, char **argv) { fprintf(stderr, "Usage: %s <rdb-file-name>\n", argv[0]); exit(1); } - createSharedObjects(); /* Needed for loading. */ + /* In order to call the loading functions we need to create the shared + * integer objects, however since this function may be called from + * an already initialized Redis instance, check if we really need to. */ + if (shared.integers[0] == NULL) + createSharedObjects(); server.loading_process_events_interval_bytes = 0; rdbCheckMode = 1; rdbCheckInfo("Checking RDB file %s", argv[1]); |