diff --git a/src/cluster_legacy.c b/src/cluster_legacy.c index def572c24..b913cd567 100644 --- a/src/cluster_legacy.c +++ b/src/cluster_legacy.c @@ -1185,6 +1185,7 @@ clusterLink *createClusterLink(clusterNode *node) { * This function will just make sure that the original node associated * with this link will have the 'link' field set to NULL. */ void freeClusterLink(clusterLink *link) { + serverAssert(link != NULL); if (link->conn) { connClose(link->conn); link->conn = NULL; @@ -5815,6 +5816,10 @@ int handleDebugClusterCommand(client *c) { addReplyErrorFormat(c, "Unknown node %s", (char *)c->argv[4]->ptr); return 1; } + if (n == server.cluster->myself) { + addReplyErrorFormat(c, "Cannot free cluster link(s) to myself"); + return 1; + } /* Terminate the link based on the direction or all. */ if (!strcasecmp(c->argv[3]->ptr, "from")) {