diff --git a/src/redis-cli.c b/src/redis-cli.c index f1d25b9be..ea37c6e93 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -453,7 +453,11 @@ static void cliLegacyIntegrateHelp(void) { if (cliConnect(CC_QUIET) == REDIS_ERR) return; redisReply *reply = redisCommand(context, "COMMAND"); - if(reply == NULL || reply->type != REDIS_REPLY_ARRAY) return; + if (reply == NULL) return; + if (reply->type != REDIS_REPLY_ARRAY) { + freeReplyObject(reply); + return; + } /* Scan the array reported by COMMAND and fill only the entries that * don't already match what we have. */ @@ -943,7 +947,10 @@ static void cliInitHelp(void) { cliLegacyIntegrateHelp(); return; }; - if (commandTable->type != REDIS_REPLY_MAP && commandTable->type != REDIS_REPLY_ARRAY) return; + if (commandTable->type != REDIS_REPLY_MAP && commandTable->type != REDIS_REPLY_ARRAY) { + freeReplyObject(commandTable); + return; + } /* Scan the array reported by COMMAND DOCS and fill in the entries */ helpEntriesLen = cliCountCommands(commandTable);