Call EVP_PKEY_free() and NETSCAPE_SPKI_free() before returning.