summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/tests/test-array.c1
-rw-r--r--common/tests/test-dict.c3
-rw-r--r--common/tests/test-tests.c2
-rw-r--r--p11-kit/tests/test-deprecated.c6
-rw-r--r--p11-kit/tests/test-uri.c3
-rw-r--r--trust/tests/frob-bc.c1
-rw-r--r--trust/tests/frob-eku.c1
-rw-r--r--trust/tests/frob-ext.c1
-rw-r--r--trust/tests/frob-ku.c2
-rw-r--r--trust/tests/frob-oid.c2
-rw-r--r--trust/tests/test-token.c2
11 files changed, 22 insertions, 2 deletions
diff --git a/common/tests/test-array.c b/common/tests/test-array.c
index 8e8f996..695917a 100644
--- a/common/tests/test-array.c
+++ b/common/tests/test-array.c
@@ -151,6 +151,7 @@ test_remove_and_count (void)
for (i = 0; i < 20000; ++i) {
value = malloc (sizeof (int));
+ assert (value != NULL);
*value = i;
if (!p11_array_push (array, value))
assert_not_reached ();
diff --git a/common/tests/test-dict.c b/common/tests/test-dict.c
index 7c6f851..f12a34e 100644
--- a/common/tests/test-dict.c
+++ b/common/tests/test-dict.c
@@ -426,6 +426,7 @@ test_hash_add_check_lots_and_collisions (void)
for (i = 0; i < 20000; ++i) {
value = malloc (sizeof (int));
+ assert (value != NULL);
*value = i;
if (!p11_dict_set (map, value, value))
assert_not_reached ();
@@ -454,6 +455,7 @@ test_hash_count (void)
for (i = 0; i < 20000; ++i) {
value = malloc (sizeof (int));
+ assert (value != NULL);
*value = i;
if (!p11_dict_set (map, value, value))
assert_not_reached ();
@@ -483,6 +485,7 @@ test_hash_ulongptr (void)
for (i = 0; i < 20000; ++i) {
value = malloc (sizeof (unsigned long));
+ assert (value != NULL);
*value = i;
if (!p11_dict_set (map, value, value))
assert_not_reached ();
diff --git a/common/tests/test-tests.c b/common/tests/test-tests.c
index cd48a13..ba31d83 100644
--- a/common/tests/test-tests.c
+++ b/common/tests/test-tests.c
@@ -60,6 +60,7 @@ test_memory (void)
if (getenv ("TEST_FAIL")) {
mem = malloc (1);
+ assert (mem != NULL);
free (mem);
*mem = 1;
}
@@ -73,6 +74,7 @@ test_leak (void)
if (getenv ("TEST_FAIL")) {
mem = malloc (1);
+ assert (mem != NULL);
*mem = 1;
}
}
diff --git a/p11-kit/tests/test-deprecated.c b/p11-kit/tests/test-deprecated.c
index 56f1941..c8b8001 100644
--- a/p11-kit/tests/test-deprecated.c
+++ b/p11-kit/tests/test-deprecated.c
@@ -376,8 +376,10 @@ test_threaded_initialization (void)
module.C_Initialize = mock_C_Initialize__threaded_race;
module.C_Finalize = mock_C_Finalize__threaded_race;
+ p11_mutex_lock (&race_mutex);
initialization_count = 0;
finalization_count = 0;
+ p11_mutex_unlock (&race_mutex);
for (i = 0; i < num_threads; i++) {
ret = p11_thread_create (&threads[i], initialization_thread, "thread-data");
@@ -404,8 +406,10 @@ test_threaded_initialization (void)
}
/* C_Initialize should have been called exactly once */
+ p11_mutex_lock (&race_mutex);
assert_num_eq (1, initialization_count);
assert_num_eq (1, finalization_count);
+ p11_mutex_unlock (&race_mutex);
assert (!mock_module_initialized ());
}
@@ -478,7 +482,7 @@ test_load_and_initialize (void)
assert (ret == 0);
rv = p11_kit_finalize_module (module);
- assert (ret == CKR_OK);
+ assert_num_eq (rv, CKR_OK);
}
int
diff --git a/p11-kit/tests/test-uri.c b/p11-kit/tests/test-uri.c
index b6de7ad..9b5b293 100644
--- a/p11-kit/tests/test-uri.c
+++ b/p11-kit/tests/test-uri.c
@@ -537,17 +537,20 @@ test_uri_build_with_attributes (void)
at.pValue = "The Label";
at.ulValueLen = 9;
ret = p11_kit_uri_set_attribute (uri, &at);
+ assert_num_eq (P11_KIT_URI_OK, ret);
at.type = CKA_ID;
at.pValue = "HELLO";
at.ulValueLen = 5;
ret = p11_kit_uri_set_attribute (uri, &at);
+ assert_num_eq (P11_KIT_URI_OK, ret);
klass = CKO_DATA;
at.type = CKA_CLASS;
at.pValue = &klass;
at.ulValueLen = sizeof (klass);
ret = p11_kit_uri_set_attribute (uri, &at);
+ assert_num_eq (P11_KIT_URI_OK, ret);
ret = p11_kit_uri_format (uri, P11_KIT_URI_FOR_ANY, &string);
assert_num_eq (P11_KIT_URI_OK, ret);
diff --git a/trust/tests/frob-bc.c b/trust/tests/frob-bc.c
index 762f8c5..41fbc58 100644
--- a/trust/tests/frob-bc.c
+++ b/trust/tests/frob-bc.c
@@ -87,6 +87,7 @@ main (int argc,
ret = asn1_der_coding (ext, "", buf, &len, message);
if (ret != ASN1_SUCCESS) {
fprintf (stderr, "asn1_der_coding: %s\n", message);
+ free (buf);
return 1;
}
diff --git a/trust/tests/frob-eku.c b/trust/tests/frob-eku.c
index 5cc5829..f467b36 100644
--- a/trust/tests/frob-eku.c
+++ b/trust/tests/frob-eku.c
@@ -88,6 +88,7 @@ main (int argc,
ret = asn1_der_coding (ekus, "", buf, &len, message);
if (ret != ASN1_SUCCESS) {
fprintf (stderr, "asn1_der_coding: %s\n", message);
+ free (buf);
return 1;
}
diff --git a/trust/tests/frob-ext.c b/trust/tests/frob-ext.c
index b1b5dd5..2017205 100644
--- a/trust/tests/frob-ext.c
+++ b/trust/tests/frob-ext.c
@@ -104,6 +104,7 @@ main (int argc,
ret = asn1_der_coding (ext, "", buf, &len, message);
if (ret != ASN1_SUCCESS) {
fprintf (stderr, "asn1_der_coding: %s\n", message);
+ free (buf);
return 1;
}
diff --git a/trust/tests/frob-ku.c b/trust/tests/frob-ku.c
index 00d45c6..99ac217 100644
--- a/trust/tests/frob-ku.c
+++ b/trust/tests/frob-ku.c
@@ -111,11 +111,13 @@ main (int argc,
ret = asn1_der_coding (ku, "", buf, &len, message);
if (ret != ASN1_SUCCESS) {
fprintf (stderr, "asn1_der_coding: %s\n", message);
+ free (buf);
return 1;
}
fwrite (buf, 1, len, stdout);
fflush (stdout);
+ free (buf);
asn1_delete_structure (&ku);
asn1_delete_structure (&definitions);
diff --git a/trust/tests/frob-oid.c b/trust/tests/frob-oid.c
index b4c7658..5a2499a 100644
--- a/trust/tests/frob-oid.c
+++ b/trust/tests/frob-oid.c
@@ -87,11 +87,13 @@ main (int argc,
ret = asn1_der_coding (oid, "", buf, &len, message);
if (ret != ASN1_SUCCESS) {
fprintf (stderr, "asn1_der_coding: %s\n", message);
+ free (buf);
return 1;
}
fwrite (buf, 1, len, stdout);
fflush (stdout);
+ free (buf);
asn1_delete_structure (&oid);
asn1_delete_structure (&definitions);
diff --git a/trust/tests/test-token.c b/trust/tests/test-token.c
index f4367c3..a24539e 100644
--- a/trust/tests/test-token.c
+++ b/trust/tests/test-token.c
@@ -91,8 +91,8 @@ static void
teardown_temp (void *unused)
{
p11_test_directory_delete (test.directory);
- free (test.directory);
teardown (test.directory);
+ free (test.directory);
}
static void