From 20d46406ed0f5abbca57e13360bec4c17495c999 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Tue, 19 May 2020 13:39:07 +0100 Subject: about: Rework freeing the san_names structure AmiSSL's approach to replacing 90% of OpenSSL calls with assembly means that the official way to pop_free a stack type won't work. As such, we open-code it here. Signed-off-by: Daniel Silverstone --- content/fetchers/about.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/content/fetchers/about.c b/content/fetchers/about.c index b00e59d91..d7c1f7e7e 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -972,7 +972,17 @@ static nserror san_to_info(X509 *cert, struct ns_cert_san **prev_next) } } } - sk_GENERAL_NAME_pop_free(san_names, GENERAL_NAME_free); + + /* AmiSSL can't cope with the "correct" mechanism of freeing + * the GENERAL_NAME stack, which is: + * sk_GENERAL_NAME_pop_free(san_names, GENERAL_NAME_free); + * So instead we do this open-coded loop which does the same: + */ + for (idx = 0; idx < san_names_nb; idx++) { + GENERAL_NAME *entry = sk_GENERAL_NAME_pop(san_names); + GENERAL_NAME_free(entry); + } + sk_GENERAL_NAME_free(san_names); return NSERROR_OK; } -- cgit v1.2.3