summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV G <eitlane@gmail.com>2023-07-13 12:37:40 +0300
committerMichael Grunder <michael.grunder@gmail.com>2023-07-14 08:37:31 -0700
commitdedc6208b15738d7765eff35a61dd09d5830e732 (patch)
treeb1e352403978531232ddf54eb064866bbd0a1d1f
parentbff171c9fc83f8abed9a283a3da2dc91a5671419 (diff)
Fix a false positive warning of gcc 12+ -Werror=maybe-uninitialized
-rw-r--r--test.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test.c b/test.c
index dc7a789..6ac3ea0 100644
--- a/test.c
+++ b/test.c
@@ -1340,7 +1340,7 @@ static void test_blocking_io_errors(struct config config) {
}
static void test_invalid_timeout_errors(struct config config) {
- redisContext *c;
+ redisContext *c = NULL;
test("Set error when an invalid timeout usec value is used during connect: ");
@@ -1355,7 +1355,7 @@ static void test_invalid_timeout_errors(struct config config) {
assert(NULL);
}
- test_cond(c->err == REDIS_ERR_IO && strcmp(c->errstr, "Invalid timeout specified") == 0);
+ test_cond(c != NULL && c->err == REDIS_ERR_IO && strcmp(c->errstr, "Invalid timeout specified") == 0);
redisFree(c);
test("Set error when an invalid timeout sec value is used during connect: ");
@@ -1371,7 +1371,7 @@ static void test_invalid_timeout_errors(struct config config) {
assert(NULL);
}
- test_cond(c->err == REDIS_ERR_IO && strcmp(c->errstr, "Invalid timeout specified") == 0);
+ test_cond(c != NULL && c->err == REDIS_ERR_IO && strcmp(c->errstr, "Invalid timeout specified") == 0);
redisFree(c);
}