From 560e6648627cfd9bf347cffe5616d8043cbe940e Mon Sep 17 00:00:00 2001 From: michael-grunder Date: Thu, 8 Sep 2022 11:08:18 -0700 Subject: Minor refactor Protect against a NULL pointer dereference, and remove unused write to a variable. --- hiredis.c | 2 +- test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hiredis.c b/hiredis.c index 5e8b606..55df883 100644 --- a/hiredis.c +++ b/hiredis.c @@ -747,7 +747,7 @@ void redisFree(redisContext *c) { if (c->privdata && c->free_privdata) c->free_privdata(c->privdata); - if (c->funcs->free_privctx) + if (c->funcs && c->funcs->free_privctx) c->funcs->free_privctx(c->privctx); memset(c, 0xff, sizeof(*c)); diff --git a/test.c b/test.c index fe9b478..67723f2 100644 --- a/test.c +++ b/test.c @@ -1999,7 +1999,7 @@ static void connectCallback(redisAsyncContext *c, int status) { } else if (t->testno == ASTEST_ISSUE_931_PING) { - status = redisAsyncCommand(c, commandCallback, NULL, "PING"); + redisAsyncCommand(c, commandCallback, NULL, "PING"); } } static void disconnectCallback(const redisAsyncContext *c, int status) { -- cgit v1.2.3