diff options
author | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2011-04-21 14:28:39 +0200 |
---|---|---|
committer | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2011-04-21 14:28:39 +0200 |
commit | e1abacb7b48b1d2c860baacabd1bbc5aa1cac30d (patch) | |
tree | 3683aa7aaf68a39b20d09b47a777a1d1955df78e | |
parent | 026636b0cd4baf5ff90b607118b6b4394edcdd05 (diff) |
Return when memory cannot be allocated
-rw-r--r-- | hiredis.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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; |