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 <dsilvers@digital-scurf.org>
This commit is contained in:
Daniel Silverstone 2020-05-19 13:39:07 +01:00
parent 3ab21dbaa4
commit 20d46406ed
No known key found for this signature in database
GPG Key ID: C30DF439F2987D74

View File

@ -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;
}