summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2011-04-21 14:28:39 +0200
committerPieter Noordhuis <pcnoordhuis@gmail.com>2011-04-21 14:28:39 +0200
commite1abacb7b48b1d2c860baacabd1bbc5aa1cac30d (patch)
tree3683aa7aaf68a39b20d09b47a777a1d1955df78e
parent026636b0cd4baf5ff90b607118b6b4394edcdd05 (diff)
Return when memory cannot be allocated
-rw-r--r--hiredis.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/hiredis.c b/hiredis.c
index efe2543..d93b38f 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -528,7 +528,12 @@ static int processItem(redisReader *r) {
}
redisReader *redisReplyReaderCreate(void) {
- redisReader *r = calloc(sizeof(redisReader),1);
+ redisReader *r;
+
+ r = calloc(sizeof(redisReader),1);
+ if (r == NULL)
+ return NULL;
+
r->err = 0;
r->errstr[0] = '\0';
r->fn = &defaultFunctions;