summaryrefslogtreecommitdiff
path: root/hiredis.c
diff options
context:
space:
mode:
authorMichael Grunder <michael.grunder@gmail.com>2019-12-18 13:45:01 -0800
committerGitHub <noreply@github.com>2019-12-18 13:45:01 -0800
commitc96d492215eb3d4c80f4d7344ac41859eced5bab (patch)
treee003d33cf6f7465502d802c90f40e2c20d06c3d9 /hiredis.c
parentb2d1ad64d03ea237e18f26fc294af87180b70d63 (diff)
parentac0b186aa3ec12eb1730f2f58b702c30d3ed5789 (diff)
Merge pull request #741 from redis/redisgetreply-null
Free the reply in redisGetReply when passed NULL
Diffstat (limited to 'hiredis.c')
-rw-r--r--hiredis.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/hiredis.c b/hiredis.c
index c461131..8e438f2 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -945,8 +945,13 @@ int redisGetReply(redisContext *c, void **reply) {
} while (aux == NULL);
}
- /* Set reply object */
- if (reply != NULL) *reply = aux;
+ /* Set reply or free it if we were passed NULL */
+ if (reply != NULL) {
+ *reply = aux;
+ } else {
+ freeReplyObject(aux);
+ }
+
return REDIS_OK;
}