Minor refactor

Protect against a NULL pointer dereference, and remove unused write
to a variable.
This commit is contained in:
michael-grunder 2022-09-08 11:08:18 -07:00 committed by Michael Grunder
parent d756f68a59
commit 560e664862
2 changed files with 2 additions and 2 deletions

View File

@ -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));

2
test.c
View File

@ -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) {