The documentation for gnutls_privkey_export_* states that the caller
must use gnutls_*_deinit on key, without mentioning whether this
requirement is still present when the function fails. But the
implementation has a code path where key is left uninitialized.
Similar to the recent fix for *_init, guarantee that *key is set to a
sane value on all exit paths.
Signed-off-by: Eric Blake <eblake@redhat.com>
{
int ret;
+ *key = NULL;
if (pkey->type != GNUTLS_PRIVKEY_PKCS11) {
gnutls_assert();
return GNUTLS_E_INVALID_REQUEST;
{
int ret;
+ *key = NULL;
if (pkey->type != GNUTLS_PRIVKEY_X509) {
gnutls_assert();
return GNUTLS_E_INVALID_REQUEST;