summaryrefslogtreecommitdiffstats
path: root/src/openvpn/pkcs11.c
diff options
context:
space:
mode:
authorAlon Bar-Lev <alon.barlev@gmail.com>2012-04-01 16:46:28 +0300
committerDavid Sommerseth <davids@redhat.com>2012-04-02 11:54:59 +0200
commit75b49e406430299b187964744f82e50a9035a0d3 (patch)
tree4d9dc4a170a9f414632d76a81ae90f854fd4151b /src/openvpn/pkcs11.c
parent12e46092bad76b88bb7439e1c1666e987669cfb1 (diff)
downloadopenvpn-75b49e406430299b187964744f82e50a9035a0d3.tar.gz
openvpn-75b49e406430299b187964744f82e50a9035a0d3.tar.xz
openvpn-75b49e406430299b187964744f82e50a9035a0d3.zip
cleanup: gc usage
Cleanup of "Use the garbage collector when retrieving x509 fields" patch series. Discussed at [1]. There should be an effort to produce common function prologue and epilogue, so that cleanups will be done at single point. [1] http://comments.gmane.org/gmane.network.openvpn.devel/5401 Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com> Acked-by: Adriaan de Jong <dejong@fox-it.com> Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'src/openvpn/pkcs11.c')
-rw-r--r--src/openvpn/pkcs11.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/openvpn/pkcs11.c b/src/openvpn/pkcs11.c
index a6b8db5..d86e267 100644
--- a/src/openvpn/pkcs11.c
+++ b/src/openvpn/pkcs11.c
@@ -769,6 +769,7 @@ show_pkcs11_ids (
const char * const provider,
bool cert_private
) {
+ struct gc_arena gc = gc_new();
pkcs11h_certificate_id_list_t user_certificates = NULL;
pkcs11h_certificate_id_list_t current = NULL;
CK_RV rv = CKR_FUNCTION_FAILED;
@@ -834,7 +835,6 @@ show_pkcs11_ids (
);
for (current = user_certificates;current != NULL; current = current->next) {
pkcs11h_certificate_t certificate = NULL;
- struct gc_arena gc = gc_new();
char *dn = NULL;
char serial[1024] = {0};
char *ser = NULL;
@@ -927,8 +927,6 @@ show_pkcs11_ids (
free (ser);
ser = NULL;
}
-
- gc_free (&gc);
}
cleanup:
@@ -938,6 +936,7 @@ cleanup:
}
pkcs11h_terminate ();
+ gc_free (&gc);
}
#else