summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-01-02 15:00:24 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-01-02 15:16:13 +0100
commita7cfb4abc7bddf1b19a4a5276e7abee144acec5f (patch)
treea55e0f61c1c2674c88b228f33b82575049f9e6cd
parentcb7b004bd07a0579a5aa65f74642cb800112ad71 (diff)
downloadgnutls-a7cfb4abc7bddf1b19a4a5276e7abee144acec5f.tar.gz
gnutls_pkcs8_info: addressed memory leak on error path
-rw-r--r--lib/x509/privkey_pkcs8.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c
index d1f9686c92..8186ececcb 100644
--- a/lib/x509/privkey_pkcs8.c
+++ b/lib/x509/privkey_pkcs8.c
@@ -526,17 +526,19 @@ gnutls_pkcs8_info(const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format,
memcpy(salt, kdf.salt, kdf.salt_size);
} else {
*salt_size = kdf.salt_size;
- return gnutls_assert_val(GNUTLS_E_SHORT_MEMORY_BUFFER);
+ ret = gnutls_assert_val(GNUTLS_E_SHORT_MEMORY_BUFFER);
+ goto cleanup;
}
}
if (salt_size)
*salt_size = kdf.salt_size;
-
return 0;
- cleanup:
+ cleanup:
+ if (oid)
+ gnutls_free(*oid);
if (need_free)
_gnutls_free_datum(&_data);
return ret;