]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: test-env-util - Make static analyzer happy
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 10 May 2021 08:26:54 +0000 (11:26 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 10 May 2021 11:41:10 +0000 (11:41 +0000)
src/lib/test-env-util.c

index 5762bfc8c5dcff21ddeb2374c2859488baa97bc3..7a246156cda5ca85207a822c1a33baf2a3d2b550 100644 (file)
@@ -39,10 +39,12 @@ void test_env_util(void)
        test_assert(getenv("b") == NULL);
        test_assert_strcmp(getenv("c"), "1");
        test_assert(getenv("d") == NULL);
-       test_assert(strcmp((*env)[0], "a=1") == 0 ||
-                   strcmp((*env)[0], "c=1") == 0);
-       test_assert(strcmp((*env)[1], "a=1") == 0 ||
-                   strcmp((*env)[1], "c=1") == 0);
+       test_assert(*env != NULL &&
+                   (null_strcmp((*env)[0], "a=1") == 0 ||
+                    null_strcmp((*env)[0], "c=1") == 0));
+       test_assert(*env != NULL &&
+                   (null_strcmp((*env)[1], "a=1") == 0 ||
+                    null_strcmp((*env)[1], "c=1") == 0));
 
        /* test env_remove() */
        env_remove("a");