From 62588dbfa7765eaf781dfd6419c6898c8b8ef5fa Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 31 Oct 2019 18:07:33 +0100 Subject: [PATCH] Modules: fix thread safe context creation crash. See #6525, this likely creates a NULL deference if the client was terminated by Redis between the creation of the blocked client and the creation of the thread safe context. --- src/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module.c b/src/module.c index d55bb4ede..600c0d4a2 100644 --- a/src/module.c +++ b/src/module.c @@ -3923,7 +3923,7 @@ RedisModuleCtx *RM_GetThreadSafeContext(RedisModuleBlockedClient *bc) { ctx->client = createClient(-1); if (bc) { selectDb(ctx->client,bc->dbid); - ctx->client->id = bc->client->id; + if (bc->client) ctx->client->id = bc->client->id; } return ctx; }