summaryrefslogtreecommitdiff
path: root/hiredis.c
diff options
context:
space:
mode:
Diffstat (limited to 'hiredis.c')
-rw-r--r--hiredis.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hiredis.c b/hiredis.c
index f1fe9bc..c774c69 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -126,7 +126,10 @@ static redisReply *redisReadIntegerReply(int fd) {
redisReply *r = malloc(sizeof(*r));
if (r == NULL) redisOOM();
- if (buf == NULL) return redisIOError();
+ if (buf == NULL) {
+ free(r);
+ return redisIOError();
+ }
r->type = REDIS_REPLY_INTEGER;
r->integer = strtoll(buf,NULL,10);
sdsfree(buf);