From 6cb9fca70d5878fde11b5f16fee259c49f936d1c Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Fri, 6 Jun 2008 11:26:07 +0000 Subject: [PATCH] Fix memory leak. The canonical X509_NAME_ENTRY STACK is reallocated rather than referencing existing X509_NAME_ENTRY structures so needs to be completely freed. --- crypto/asn1/x_name.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto/asn1/x_name.c b/crypto/asn1/x_name.c index 3c9344c17f..b46434c7bd 100644 --- a/crypto/asn1/x_name.c +++ b/crypto/asn1/x_name.c @@ -244,6 +244,11 @@ static void local_sk_X509_NAME_ENTRY_free(STACK_OF(X509_NAME_ENTRY) *ne) sk_X509_NAME_ENTRY_free(ne); } +static void local_sk_X509_NAME_ENTRY_pop_free(STACK_OF(X509_NAME_ENTRY) *ne) + { + sk_X509_NAME_ENTRY_pop_free(ne, X509_NAME_ENTRY_free); + } + static int x509_name_encode(X509_NAME *a) { union { STACK_OF(STACK_OF_X509_NAME_ENTRY) *s; @@ -372,7 +377,7 @@ static int x509_name_canon(X509_NAME *a) X509_NAME_ENTRY_free(tmpentry); if (intname) sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname, - local_sk_X509_NAME_ENTRY_free); + local_sk_X509_NAME_ENTRY_pop_free); return ret; } -- 2.25.1