diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-01-04 09:28:23 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-01-04 12:22:01 +0100 |
commit | 9e7890ed6730b6c97f92dc529088484619e2e92a (patch) | |
tree | 18971dd41c283b462156018f020c3b9239f10b63 | |
parent | 7355fc9c240a1f4dcff25245b4baad2a97af61a2 (diff) | |
download | gnutls-9e7890ed6730b6c97f92dc529088484619e2e92a.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; |