summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hiredis.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hiredis.c b/hiredis.c
index 10ac8d0..a36c6f3 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -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;
}