Skip to content

Commit

Permalink
Minor refactor
Browse files Browse the repository at this point in the history
Protect against a NULL pointer dereference, and remove unused write
to a variable.
  • Loading branch information
michael-grunder committed Sep 8, 2022
1 parent d756f68 commit 560e664
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hiredis.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 560e664

Please sign in to comment.