summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2010-08-30 15:42:24 +0200
committerantirez <antirez@gmail.com>2010-08-30 15:42:24 +0200
commite7aa0b4b5244b7c8a508067b2836b3f7e7137552 (patch)
treef12bb3cbf5a0f57d95eded1137b9b15a8e54d96b
parent4b5f030d4fa41156390b38d6db8842de78f19dba (diff)
memory leak resolved in redisReadIntegerReply
-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);