Skip to content

Commit 7f82a6c

Browse files
committed
Fix leak on failed redisAsyncConnect
Free hiredis async context when redisAsyncConnect returns an error state, instead of leaking it (improves valgrind results under cluster send/reconnect scenarios).
1 parent a640526 commit 7f82a6c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/cluster.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,9 @@ static void MR_ConnectToShard(Node* n){
637637
return;
638638
}
639639
if (c->err) {
640-
/* Let *c leak for now... */
640+
/* Connection context was created but is in an error state - free it. */
641641
RedisModule_Log(mr_staticCtx, "warning", "Error: %s\n", c->errstr);
642+
redisAsyncFree(c);
642643
return;
643644
}
644645
c->data = n;

0 commit comments

Comments
 (0)