summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-10-31 18:07:33 +0100
committerantirez <antirez@gmail.com>2019-10-31 18:09:06 +0100
commit62588dbfa7765eaf781dfd6419c6898c8b8ef5fa (patch)
treec7161c3ef344d03b333268fd59a45c1b84f6ff5e
parentbb78454b0fef0dc5903328d037ac2520108e0044 (diff)
downloadredis-62588dbfa7765eaf781dfd6419c6898c8b8ef5fa.tar.gz
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.
-rw-r--r--src/module.c2
1 files changed, 1 insertions, 1 deletions
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;
}