Skip to content

Commit

Permalink
Return when memory cannot be allocated
Browse files Browse the repository at this point in the history
  • Loading branch information
pietern committed Apr 21, 2011
1 parent 026636b commit e1abacb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hiredis.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e1abacb

Please sign in to comment.