From ddab90ece4b9bdefa04e7c55ade5462fdf58cdef Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 2 Sep 2013 16:14:22 +0200 Subject: [PATCH] Fixed alt_names free, now using cleanup function to wrap details. --- include/freerdp/crypto/crypto.h | 5 ++++- libfreerdp/crypto/crypto.c | 20 ++++++++++++++++++++ libfreerdp/crypto/tls.c | 5 ++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/include/freerdp/crypto/crypto.h b/include/freerdp/crypto/crypto.h index b939e2060..e9130dbef 100644 --- a/include/freerdp/crypto/crypto.h +++ b/include/freerdp/crypto/crypto.h @@ -118,7 +118,10 @@ FREERDP_API CryptoCert crypto_cert_read(BYTE* data, UINT32 length); FREERDP_API char* crypto_cert_fingerprint(X509* xcert); FREERDP_API char* crypto_cert_subject(X509* xcert); FREERDP_API char* crypto_cert_subject_common_name(X509* xcert, int* length); -FREERDP_API char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths); +FREERDP_API char** crypto_cert_subject_alt_name(X509* xcert, int* count, + int** lengths); +FREERDP_API void crypto_cert_subject_alt_name_free(int count, int *lengths, + char** alt_name); FREERDP_API char* crypto_cert_issuer(X509* xcert); FREERDP_API void crypto_cert_print_info(X509* xcert); FREERDP_API void crypto_cert_free(CryptoCert cert); diff --git a/libfreerdp/crypto/crypto.c b/libfreerdp/crypto/crypto.c index e84712ba0..64c42e91e 100644 --- a/libfreerdp/crypto/crypto.c +++ b/libfreerdp/crypto/crypto.c @@ -392,6 +392,26 @@ char* crypto_cert_subject_common_name(X509* xcert, int* length) return (char*) common_name; } +FREERDP_API void crypto_cert_subject_alt_name_free(int count, int *lengths, + char** alt_name) +{ + int i; + + if (lengths) + free(lengths); + + if (alt_name) + { + for (i=0; i