diff options
-rw-r--r-- | common/test-tests.c | 2 | ||||
-rw-r--r-- | common/test.c | 4 | ||||
-rw-r--r-- | p11-kit/server.c | 8 | ||||
-rw-r--r-- | trust/test-bundle.c | 9 | ||||
-rw-r--r-- | trust/test-openssl.c | 9 | ||||
-rw-r--r-- | trust/test-save.c | 22 | ||||
-rw-r--r-- | trust/test-trust.c | 4 |
7 files changed, 42 insertions, 16 deletions
diff --git a/common/test-tests.c b/common/test-tests.c index ba31d83..2ca1929 100644 --- a/common/test-tests.c +++ b/common/test-tests.c @@ -62,6 +62,7 @@ test_memory (void) mem = malloc (1); assert (mem != NULL); free (mem); + /* cppcheck-suppress deallocuse */ *mem = 1; } } @@ -77,6 +78,7 @@ test_leak (void) assert (mem != NULL); *mem = 1; } + /* cppcheck-suppress memleak */ } int diff --git a/common/test.c b/common/test.c index 18cb501..c88aff1 100644 --- a/common/test.c +++ b/common/test.c @@ -457,6 +457,7 @@ p11_test_directory (const char *prefix) directory, strerror (errno)); free (directory); assert_not_reached (); + return NULL; } free (templ); @@ -483,6 +484,7 @@ p11_test_file_write (const char *base, printf ("# couldn't open file for writing: %s: %s\n", name, strerror (errno)); free (path); assert_not_reached (); + return; } if (fwrite (contents, 1, length, f) != length || @@ -490,6 +492,7 @@ p11_test_file_write (const char *base, printf ("# couldn't write to file: %s: %s\n", name, strerror (errno)); free (path); assert_not_reached (); + return; } free (path); @@ -511,6 +514,7 @@ p11_test_file_delete (const char *base, printf ("# Couldn't delete file: %s\n", name); free (path); assert_not_reached (); + return; } free (path); diff --git a/p11-kit/server.c b/p11-kit/server.c index a737c2a..75b93d6 100644 --- a/p11-kit/server.c +++ b/p11-kit/server.c @@ -147,13 +147,17 @@ server_new (const char **tokens, size_t n_tokens, const char *provider, if (strncmp (tokens[0], "pkcs11:", 7) == 0) { if (server->provider) { server->module = p11_kit_module_load (server->provider, 0); - if (server->module == NULL) + if (server->module == NULL) { + free (server); return NULL; + } } } else { server->module = p11_kit_module_load (tokens[0], 0); - if (server->module == NULL) + if (server->module == NULL) { + free (server); return NULL; + } } #endif /* OS_WIN32 */ diff --git a/trust/test-bundle.c b/trust/test-bundle.c index 3f4bcad..f1c2841 100644 --- a/trust/test-bundle.c +++ b/trust/test-bundle.c @@ -236,11 +236,14 @@ test_directory_hash (void) ret = p11_extract_pem_directory_hash (&test.ex, test.directory); assert_num_eq (true, ret); - test_check_directory (test.directory, ("Cacert3_Here.pem", "Cacert3_Here.1.pem", #ifdef OS_UNIX - "e5662767.1", "e5662767.0", "590d426f.1", "590d426f.0", + test_check_directory (test.directory, ("Cacert3_Here.pem", "Cacert3_Here.1.pem", + "e5662767.1", "e5662767.0", "590d426f.1", "590d426f.0", + NULL)); +#else + test_check_directory (test.directory, ("Cacert3_Here.pem", "Cacert3_Here.1.pem", + NULL)); #endif - NULL)); test_check_file (test.directory, "Cacert3_Here.pem", SRCDIR "/trust/fixtures/cacert3.pem"); test_check_file (test.directory, "Cacert3_Here.1.pem", SRCDIR "/trust/fixtures/cacert3.pem"); #ifdef OS_UNIX diff --git a/trust/test-openssl.c b/trust/test-openssl.c index b1276df..3c20625 100644 --- a/trust/test-openssl.c +++ b/trust/test-openssl.c @@ -595,11 +595,14 @@ test_directory (void) ret = p11_extract_openssl_directory (&test.ex, test.directory); assert_num_eq (true, ret); - test_check_directory (test.directory, ("Custom_Label.pem", "Custom_Label.1.pem", #ifdef OS_UNIX - "e5662767.1", "e5662767.0", "590d426f.1", "590d426f.0", + test_check_directory (test.directory, ("Custom_Label.pem", "Custom_Label.1.pem", + "e5662767.1", "e5662767.0", "590d426f.1", "590d426f.0", + NULL)); +#else + test_check_directory (test.directory, ("Custom_Label.pem", "Custom_Label.1.pem", + NULL)); #endif - NULL)); test_check_file (test.directory, "Custom_Label.pem", SRCDIR "/trust/fixtures/cacert3-trusted-server-alias.pem"); test_check_file (test.directory, "Custom_Label.1.pem", diff --git a/trust/test-save.c b/trust/test-save.c index 1de798d..0609e79 100644 --- a/trust/test-save.c +++ b/trust/test-save.c @@ -357,11 +357,14 @@ test_directory_files (void) ret = p11_save_finish_directory (dir, true); assert_num_eq (true, ret); - test_check_directory (subdir, ("blah.cer", "file.txt", #ifdef OS_UNIX + test_check_directory (subdir, ("blah.cer", "file.txt", "link.ext", -#endif NULL)); +#else + test_check_directory (subdir, ("blah.cer", "file.txt", + NULL)); +#endif test_check_file (subdir, "blah.cer", SRCDIR "/trust/fixtures/cacert3.der"); test_check_data (subdir, "file.txt", test_text, strlen (test_text)); #ifdef OS_UNIX @@ -443,13 +446,18 @@ test_directory_dups (void) ret = p11_save_finish_directory (dir, true); assert_num_eq (true, ret); - test_check_directory (subdir, ("file.txt", "file.1.txt", "file.2.txt", - "no-ext", "no-ext.1", - "with-num.0", "with-num.1", #ifdef OS_UNIX - "link.0", "link.1", + test_check_directory (subdir, ("file.txt", "file.1.txt", "file.2.txt", + "no-ext", "no-ext.1", + "with-num.0", "with-num.1", + "link.0", "link.1", + NULL)); +#else + test_check_directory (subdir, ("file.txt", "file.1.txt", "file.2.txt", + "no-ext", "no-ext.1", + "with-num.0", "with-num.1", + NULL)); #endif - NULL)); test_check_data (subdir, "file.txt", test_text, 5); test_check_data (subdir, "file.1.txt", test_text, 10); test_check_data (subdir, "file.2.txt", test_text, 15); diff --git a/trust/test-trust.c b/trust/test-trust.c index 802007d..29b2797 100644 --- a/trust/test-trust.c +++ b/trust/test-trust.c @@ -283,8 +283,10 @@ test_check_directory_files (const char *file, va_start (va, file); while (file != NULL) { - if (!p11_dict_set (files, (void *)file, (void *)file)) + if (!p11_dict_set (files, (void *)file, (void *)file)) { + va_end (va); return_val_if_reached (NULL); + } file = va_arg (va, const char *); } |