Unverified Commit 964f4a45 authored by Harkrishn Patro's avatar Harkrishn Patro Committed by GitHub
Browse files

Avoid double free of cluster link (#12930)

Avoid crash while performing `DEBUG CLUSTERLINK KILL` mutliple times
(cluster link might not be created/valid).
parent b3aaa0a1
......@@ -5796,12 +5796,12 @@ int handleDebugClusterCommand(client *c) {
/* Terminate the link based on the direction or all. */
if (!strcasecmp(c->argv[3]->ptr, "from")) {
freeClusterLink(n->inbound_link);
if (n->inbound_link) freeClusterLink(n->inbound_link);
} else if (!strcasecmp(c->argv[3]->ptr, "to")) {
freeClusterLink(n->link);
if (n->link) freeClusterLink(n->link);
} else if (!strcasecmp(c->argv[3]->ptr, "all")) {
freeClusterLink(n->link);
freeClusterLink(n->inbound_link);
if (n->link) freeClusterLink(n->link);
if (n->inbound_link) freeClusterLink(n->inbound_link);
} else {
addReplyErrorFormat(c, "Unknown direction %s", (char *) c->argv[3]->ptr);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment