From e7aa0b4b5244b7c8a508067b2836b3f7e7137552 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 30 Aug 2010 15:42:24 +0200 Subject: memory leak resolved in redisReadIntegerReply --- hiredis.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3