Describe the bug
A possible memory leak in the function cliLegacyIntegrateHelp
at redis-cli.c
To reproduce
reply
gets assigned with a heap-allocated ptr. HERE- Branch condition may evaluate to true for
(reply->type != REDIS_REPLY_ARRAY) == true
. HERE - Function returns without calling
freeReplyObject(reply);
.
Expected behavior
The heap-allocated pointer reply
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.