This function was just freeing the stack object itself of GENERAL_NAMES with wolfSSL_sk_free, but this doesn't free the data in the items of the stack. The fix is to replace wolfSSL_sk_free with wolfSSL_sk_GENERAL_NAME_free.
Before creating any new configure files (.conf) read the CONF_FILES_README.md