Commit d1e820d8 authored by NanXiao's avatar NanXiao Committed by Matt Stancliff
Browse files

Add error check in redisContextInit

Check whether the obuf or reader is empty: if one of the items is empty,
free the redisContext.
parent b6a86079
......@@ -1059,6 +1059,12 @@ static redisContext *redisContextInit(void) {
c->errstr[0] = '\0';
c->obuf = sdsempty();
c->reader = redisReaderCreate();
if (c->obuf == NULL || c->reader == NULL) {
redisFree(c);
return NULL;
}
return c;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment