From 53294e537cd6c267b96320e68dde5c36a4ac4ffb Mon Sep 17 00:00:00 2001 From: Binbin Date: Thu, 9 Nov 2023 01:14:36 +0800 Subject: [PATCH] Fix genClusterDebugString minor sds leaks (#12739) This function now will only be called in printCrashReport, so this is just a cleanup. --- src/debug.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/debug.c b/src/debug.c index 9e1d48bd0..fd1cf21c2 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1972,11 +1972,17 @@ void logStackTrace(void *eip, int uplevel) { #endif /* HAVE_BACKTRACE */ sds genClusterDebugString(sds infostring) { + sds cluster_info = genClusterInfoString(); + sds cluster_nodes = clusterGenNodesDescription(NULL, 0, 0); + infostring = sdscatprintf(infostring, "\r\n# Cluster info\r\n"); - infostring = sdscatsds(infostring, genClusterInfoString()); + infostring = sdscatsds(infostring, cluster_info); infostring = sdscatprintf(infostring, "\n------ CLUSTER NODES OUTPUT ------\n"); - infostring = sdscatsds(infostring, clusterGenNodesDescription(NULL, 0, 0)); - + infostring = sdscatsds(infostring, cluster_nodes); + + sdsfree(cluster_info); + sdsfree(cluster_nodes); + return infostring; }