MT#59962 DRedisConnection: ensure redis_context isn't NULL

When dereferencing it (after creating a new context before)
make sure it's not NULL even when just checking for
a connection error, as it might still be NULL and hence
will just seg.fault in this case.

Fixes:

    Dereference before null check (REVERSE_INULL)
    check_after_deref: Null-checking this->redis_context suggests
    that it may be null, but it has already been dereferenced on all paths leading to the check.

Change-Id: I67f88f1dfccef66751298b1c26e85efba0458c1f
master
Donat Zenichev 1 month ago
parent 6dfc04d3cc
commit 8f95edc9c4

@ -63,7 +63,7 @@ bool DRedisConnection::connect()
cfg.tv_timeout);
}
if (redis_context->err) {
if (redis_context != NULL && redis_context->err) {
ERROR("REDIS Connection error: %s\n", redis_context->errstr);
disconnect();
return false;

Loading…
Cancel
Save