From e1abacb7b48b1d2c860baacabd1bbc5aa1cac30d Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Thu, 21 Apr 2011 14:28:39 +0200 Subject: Return when memory cannot be allocated --- hiredis.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3