summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Stancliff <matt@genges.com>2015-01-05 10:22:22 -0500
committerMatt Stancliff <matt@genges.com>2015-01-05 16:39:30 -0500
commit9b83ddc2d99ffc2b650e7efc9e0ed82ecb37fdf3 (patch)
tree853332433fbce2ebec2c12cd2d684e6a4b823758
parent7c4d2557c4bbc637514392cb725719790b50f677 (diff)
downloadhiredict-9b83ddc2d99ffc2b650e7efc9e0ed82ecb37fdf3.tar.xz
Fix clang analyzer warning
redisAsyncInitialize() can return NULL, but then we pass the return value from redisAsyncInitialize() into something dereferencing the return value, which can cause crashies.
-rw-r--r--async.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/async.c b/async.c
index 8b50de2..5acd01c 100644
--- a/async.c
+++ b/async.c
@@ -142,6 +142,9 @@ static redisAsyncContext *redisAsyncInitialize(redisContext *c) {
/* We want the error field to be accessible directly instead of requiring
* an indirection to the redisContext struct. */
static void __redisAsyncCopyError(redisAsyncContext *ac) {
+ if (!ac)
+ return;
+
redisContext *c = &(ac->c);
ac->err = c->err;
ac->errstr = c->errstr;