Skip to content

Fix a couple of bugs uncovered by the Clang static analyzer #215

merged 2 commits into from Jan 15, 2014

2 participants


I ran the Clang static analyzer on a project I'm working on that uses hiredis and it found a couple of bugs.

There were three warnings, of which two are definitely legit. I have fixed these in the commits below.

The one warning I wasn't sure about was this one:

async.c:447:19: warning: The left operand of '!=' is a garbage value
        if (cb.fn != NULL) {
            ~~~~~ ^

This is in redisProcessCallbacks and it looks like it's triggerable when redisGetReply returns REDIS_OK but doesn't set reply to anything. I'm not familiar enough with the code to determine if this is possible though.

Redis member
pietern commented Jan 15, 2014

Looks good, thanks!

@pietern pietern merged commit 065e905 into redis:master Jan 15, 2014

1 check passed

Details default The Travis CI build passed
@charliesome charliesome deleted the charliesome:fix-bugs branch Jan 15, 2014

@pietern Yep, although if the first call to redisGetReply doesn't read a full reply and we're in monitor mode, it looks like it may be possible that a garbage cb is pushed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.