diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-01-04 09:28:23 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-01-04 13:41:18 +0100 |
commit | c6af27511f3568b81675965c6907bf0c45725bcd (patch) | |
tree | 18971dd41c283b462156018f020c3b9239f10b63 | |
parent | 365fe5725b7c1000605fc48696ded2ead22ca37c (diff) | |
download | gnutls-c6af27511f3568b81675965c6907bf0c45725bcd.tar.gz |
decode_private_key_info: eliminate memory leaks on error path
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | lib/x509/privkey_pkcs8.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c index 8186ececcb..f7ada0234b 100644 --- a/lib/x509/privkey_pkcs8.c +++ b/lib/x509/privkey_pkcs8.c @@ -1101,12 +1101,14 @@ decode_private_key_info(const gnutls_datum_t * der, result = _decode_pkcs8_dsa_key(pkcs8_asn, pkey); else if (pkey->pk_algorithm == GNUTLS_PK_EC) result = _decode_pkcs8_ecc_key(pkcs8_asn, pkey); - else - return gnutls_assert_val(GNUTLS_E_UNIMPLEMENTED_FEATURE); + else { + result = gnutls_assert_val(GNUTLS_E_UNIMPLEMENTED_FEATURE); + goto error; + } if (result < 0) { gnutls_assert(); - return result; + goto error; } result = 0; |