diff --git a/daemon/redis.c b/daemon/redis.c index 3fb9e5df0..4e18a812a 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -2316,9 +2316,14 @@ int redis_restore(struct redis *r, bool foreign, int db) { mutex_init(&ctx.r_m); g_queue_init(&ctx.r_q); ctx.foreign = foreign; - for (int i = 0; i < rtpe_config.redis_num_threads; i++) - g_queue_push_tail(&ctx.r_q, - redis_dup(r, db)); + for (int i = 0; i < rtpe_config.redis_num_threads; i++) { + struct redis *dup = redis_dup(r, db); + if (!dup) { + rlog(LOG_ERR, "Failed to create thread connection to Redis"); + goto err; + } + g_queue_push_tail(&ctx.r_q, dup); + } gtp = g_thread_pool_new(restore_thread, &ctx, rtpe_config.redis_num_threads, TRUE, NULL); for (int i = 0; i < calls->elements; i++) {