diff options
author | michael-grunder <michael.grunder@gmail.com> | 2018-05-13 18:08:57 -0700 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2018-05-13 18:08:57 -0700 |
commit | 7a1acdfeb58b3e3a84a7b5d34af5ec1daae0f603 (patch) | |
tree | c936a04bdcf6ad8079a20a4e61aa1fbfb9def6f7 /read.c | |
parent | c1af0e849d6387a4297a1e1066c107f6f72d8469 (diff) | |
parent | 58e6b87f51ba31b4a2954d0babe6b3cf7019c985 (diff) |
Merge remote-tracking branch 'justinbrewer/hiredis-pr1' into posix-build-fixes
Diffstat (limited to 'read.c')
-rw-r--r-- | read.c | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -52,11 +52,9 @@ static void __redisReaderSetError(redisReader *r, int type, const char *str) { } /* Clear input buffer on errors. */ - if (r->buf != NULL) { - sdsfree(r->buf); - r->buf = NULL; - r->pos = r->len = 0; - } + sdsfree(r->buf); + r->buf = NULL; + r->pos = r->len = 0; /* Reset task stack. */ r->ridx = -1; @@ -420,8 +418,6 @@ redisReader *redisReaderCreateWithFunctions(redisReplyObjectFunctions *fn) { if (r == NULL) return NULL; - r->err = 0; - r->errstr[0] = '\0'; r->fn = fn; r->buf = sdsempty(); r->maxbuf = REDIS_READER_MAX_BUF; @@ -435,10 +431,11 @@ redisReader *redisReaderCreateWithFunctions(redisReplyObjectFunctions *fn) { } void redisReaderFree(redisReader *r) { + if (r == NULL) + return; if (r->reply != NULL && r->fn && r->fn->freeObject) r->fn->freeObject(r->reply); - if (r->buf != NULL) - sdsfree(r->buf); + sdsfree(r->buf); free(r); } |