From 187efdad6cce9d809697529f4cff52b4d384d988 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 5 Dec 2008 09:00:24 +0000 Subject: [PATCH] ITS#5849 free peer cert after retrieving DN --- libraries/libldap/tls.c | 1 + libraries/libldap/tls_o.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/libraries/libldap/tls.c b/libraries/libldap/tls.c index 9b008ddb9c..7bba905124 100644 --- a/libraries/libldap/tls.c +++ b/libraries/libldap/tls.c @@ -1735,6 +1735,7 @@ tls_get_cert_dn( tls_session *session, struct berval *dnbv ) xn = X509_get_subject_name(x); dnbv->bv_len = i2d_X509_NAME( xn, NULL ); dnbv->bv_val = xn->bytes->data; + X509_free(x); return 0; } #endif /* HAVE_GNUTLS */ diff --git a/libraries/libldap/tls_o.c b/libraries/libldap/tls_o.c index 62c9638f07..f90eed2597 100644 --- a/libraries/libldap/tls_o.c +++ b/libraries/libldap/tls_o.c @@ -452,6 +452,7 @@ tlso_session_my_dn( tls_session *sess, struct berval *der_dn ) xn = X509_get_subject_name(x); der_dn->bv_len = i2d_X509_NAME( xn, NULL ); der_dn->bv_val = xn->bytes->data; + X509_free(x); return 0; } @@ -478,6 +479,7 @@ tlso_session_peer_dn( tls_session *sess, struct berval *der_dn ) xn = X509_get_subject_name(x); der_dn->bv_len = i2d_X509_NAME( xn, NULL ); der_dn->bv_val = xn->bytes->data; + X509_free(x); return 0; } -- 2.39.5