diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-03-31 16:17:07 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-03-31 16:30:25 +0200 |
commit | d00fd03ec716c70821fee1723de4f22b26b7a99a (patch) | |
tree | 6ba865ae3f64f10da59a5d9e3f3b4ff27c010fa4 | |
parent | cb97d214c877830f2928410252dd2bb5074923df (diff) | |
download | gnutls-d00fd03ec716c70821fee1723de4f22b26b7a99a.tar.gz |
gnutls_pkcs8_info: do not free oid on GNUTLS_E_UNKNOWN_CIPHER_TYPE
The documented behavior of the function was to return a valid
OID in that case.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | lib/x509/privkey_pkcs8.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c index 8186ececcb..87eafca637 100644 --- a/lib/x509/privkey_pkcs8.c +++ b/lib/x509/privkey_pkcs8.c @@ -458,6 +458,8 @@ gnutls_x509_privkey_export_pkcs8(gnutls_x509_privkey_t key, * Returns: %GNUTLS_E_INVALID_REQUEST if the provided structure isn't an encrypted key, * %GNUTLS_E_UNKNOWN_CIPHER_TYPE if the structure's encryption isn't supported, or * another negative error code in case of a failure. Zero on success. + * + * Since: 3.4.0 **/ int gnutls_pkcs8_info(const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, @@ -537,8 +539,10 @@ gnutls_pkcs8_info(const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, return 0; cleanup: - if (oid) + if (ret != GNUTLS_E_UNKNOWN_CIPHER_TYPE && oid) { gnutls_free(*oid); + *oid = NULL; + } if (need_free) _gnutls_free_datum(&_data); return ret; |