summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2013-03-20 22:20:25 +0100
committerStef Walter <stefw@gnome.org>2013-03-20 22:22:30 +0100
commit4b09d2b4d3958b58b020c1ae21fcd932e1eb6c37 (patch)
treeabba9eb25d2d7d4c9804ba56741e08e40b0fe417 /tools
parent57d8f36a6cfbde5a9a783f11f2b75f19005c23e1 (diff)
Fix memory leaks reported by 'make leakcheck'
Diffstat (limited to 'tools')
-rw-r--r--tools/extract-openssl.c3
-rw-r--r--tools/tests/test-openssl.c7
-rw-r--r--tools/tests/test-pem.c6
-rw-r--r--tools/tests/test-save.c2
-rw-r--r--tools/tests/test-x509.c3
5 files changed, 15 insertions, 6 deletions
diff --git a/tools/extract-openssl.c b/tools/extract-openssl.c
index 8e02421..cf387f7 100644
--- a/tools/extract-openssl.c
+++ b/tools/extract-openssl.c
@@ -602,9 +602,6 @@ p11_extract_openssl_directory (P11KitIter *iter,
p11_buffer_init (&buf, 0);
while ((rv = p11_kit_iter_next (iter)) == CKR_OK) {
- pem = p11_pem_write (ex->cert_der, ex->cert_len, "CERTIFICATE", &length);
- return_val_if_fail (pem != NULL, false);
-
if (!p11_buffer_reset (&buf, 1024))
return_val_if_reached (false);
diff --git a/tools/tests/test-openssl.c b/tools/tests/test-openssl.c
index dc68c19..77df109 100644
--- a/tools/tests/test-openssl.c
+++ b/tools/tests/test-openssl.c
@@ -184,6 +184,7 @@ test_file (CuTest *tc)
test_check_file (tc, test.directory, "extract.pem",
SRCDIR "/files/cacert3-trusted-server-alias.pem");
+ free (test.ex.destination);
teardown (tc);
}
@@ -208,6 +209,7 @@ test_plain (CuTest *tc)
test_check_file (tc, test.directory, "extract.pem",
SRCDIR "/files/cacert3-trusted-alias.pem");
+ free (test.ex.destination);
teardown (tc);
}
@@ -250,6 +252,7 @@ test_keyid (CuTest *tc)
test_check_file (tc, test.directory, "extract.pem",
SRCDIR "/files/cacert3-trusted-keyid.pem");
+ free (test.ex.destination);
teardown (tc);
}
@@ -282,6 +285,7 @@ test_not_authority (CuTest *tc)
test_check_file (tc, test.directory, "extract.pem",
SRCDIR "/files/cacert3-not-trusted.pem");
+ free (test.ex.destination);
teardown (tc);
}
@@ -316,6 +320,7 @@ test_distrust_all (CuTest *tc)
test_check_file (tc, test.directory, "extract.pem",
SRCDIR "/files/cacert3-distrust-all.pem");
+ free (test.ex.destination);
teardown (tc);
}
@@ -347,6 +352,7 @@ test_file_multiple (CuTest *tc)
test_check_file (tc, test.directory, "extract.pem",
SRCDIR "/files/cacert3-trusted-multiple.pem");
+ free (test.ex.destination);
teardown (tc);
}
@@ -369,6 +375,7 @@ test_file_without (CuTest *tc)
test_check_data (tc, test.directory, "extract.pem", "", 0);
+ free (test.ex.destination);
teardown (tc);
}
diff --git a/tools/tests/test-pem.c b/tools/tests/test-pem.c
index 3be8fee..5c19455 100644
--- a/tools/tests/test-pem.c
+++ b/tools/tests/test-pem.c
@@ -135,6 +135,7 @@ test_file (CuTest *tc)
test_check_file (tc, test.directory, "extract.pem", SRCDIR "/files/cacert3.pem");
+ free (test.ex.destination);
teardown (tc);
}
@@ -160,6 +161,7 @@ test_file_multiple (CuTest *tc)
test_check_file (tc, test.directory, "extract.pem", SRCDIR "/files/cacert3-twice.pem");
+ free (test.ex.destination);
teardown (tc);
}
@@ -174,9 +176,6 @@ test_file_without (CuTest *tc)
p11_kit_iter_add_filter (test.iter, certificate_filter, 1);
p11_kit_iter_begin_with (test.iter, &test.module, 0, 0);
- if (asprintf (&test.ex.destination, "%s/%s", test.directory, "extract.cer") < 0)
- assert_not_reached ();
-
if (asprintf (&test.ex.destination, "%s/%s", test.directory, "extract.pem") < 0)
assert_not_reached ();
@@ -185,6 +184,7 @@ test_file_without (CuTest *tc)
test_check_data (tc, test.directory, "extract.pem", "", 0);
+ free (test.ex.destination);
teardown (tc);
}
diff --git a/tools/tests/test-save.c b/tools/tests/test-save.c
index cd6cb44..32713ee 100644
--- a/tools/tests/test-save.c
+++ b/tools/tests/test-save.c
@@ -91,6 +91,8 @@ write_zero_file (CuTest *tc,
CuAssertTrue (tc, fd != -1);
res = close (fd);
CuAssertTrue (tc, res >= 0);
+
+ free (filename);
}
static void
diff --git a/tools/tests/test-x509.c b/tools/tests/test-x509.c
index f3585f1..7cf9787 100644
--- a/tools/tests/test-x509.c
+++ b/tools/tests/test-x509.c
@@ -135,6 +135,7 @@ test_file (CuTest *tc)
test_check_file (tc, test.directory, "extract.cer", SRCDIR "/files/cacert3.der");
+ free (test.ex.destination);
teardown (tc);
}
@@ -166,6 +167,7 @@ test_file_multiple (CuTest *tc)
test_check_file (tc, test.directory, "extract.cer", SRCDIR "/files/cacert3.der");
+ free (test.ex.destination);
teardown (tc);
}
@@ -192,6 +194,7 @@ test_file_without (CuTest *tc)
p11_message_loud ();
+ free (test.ex.destination);
teardown (tc);
}