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.
This commit is contained in:
antirez 2016-07-06 19:05:44 +02:00
parent 24882e31f2
commit eee878cbc5

View File

@ -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]);