Subject: | calling X509_get_subject_name() from a verify callback function causes a memory leak |
Date: | Mon, 6 Feb 2017 13:16:53 -0800 |
To: | bug-Net-SSLeay [...] rt.cpan.org |
From: | Jim Westfall <jwestfall [...] surrealistic.net> |
Hi
If you use Net::SSLeay::X509_get_subject_name($cert) from within a
Net::SSLeay::CTX_set_verify() callback function its leaking memory.
Attached is a sample script showing the issue. If you comment out the
call to X509_get_subject_name() the leak magically stops.
If you dont use a callback, say just use get_https3() then doing a
X509_get_subject_name() on that cert the leak doesnt happen.
The only way I've gotten the callback leak to stop is with the following
patch
--- Net-SSLeay-1.80/SSLeay.xs 2017-01-04 13:39:08.000000000 -0800
+++ Net-SSLeay-1.80-altnames/SSLeay.xs 2017-02-06 09:21:55.000000000 -0800
@@ -3120,6 +3120,7 @@ X509_get_subjectAltNames(cert)
}
}
+ sk_GENERAL_NAME_pop_free(subjAltNameDNs, GENERAL_NAME_free);
}
XSRETURN(count * 2);
thanks
jim
Message body is not shown because sender requested not to inline it.