Describe the bug
A possible memory leak in the function cliInitHelp at redis-cli.c
To reproduce
commandTable gets assigned with a heap-allocated ptr. HERE
- Branch condition may evaluate to true:
if (commandTable->type != REDIS_REPLY_MAP && commandTable->type != REDIS_REPLY_ARRAY). HERE
- Function returns without calling
freeReplyObject(commandTable);, as the other branchs did.
Expected behavior
The heap-allocated pointer commandTable should be freed when going out of scope.
Additional information
In the long call chain of redisCommand, when the reply object gets returned, the original ptr gets assigned to NULL here, making the returned ptr the only reference to the reply object.
Describe the bug
A possible memory leak in the function
cliInitHelpat redis-cli.cTo reproduce
commandTablegets assigned with a heap-allocated ptr. HEREif (commandTable->type != REDIS_REPLY_MAP && commandTable->type != REDIS_REPLY_ARRAY). HEREfreeReplyObject(commandTable);, as the other branchs did.Expected behavior
The heap-allocated pointer
commandTableshould be freed when going out of scope.Additional information
In the long call chain of
redisCommand, when the reply object gets returned, the original ptr gets assigned to NULL here, making the returned ptr the only reference to the reply object.