summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2016-08-28 21:42:34 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2016-08-29 08:07:47 +0200
commitdf97319e4c73b867f2b91546b5cf5ffa741cb9d5 (patch)
tree8dc1ceed9b836b69322019221a72aafc197904b9
parent8469db9dbcdd6ec22094a4f095201d80d981b9f0 (diff)
downloadgnutls-df97319e4c73b867f2b91546b5cf5ffa741cb9d5.tar.gz
gnutls_pkcs12_simple_parse: set the key value to null on failure
-rw-r--r--lib/x509/pkcs12.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/x509/pkcs12.c b/lib/x509/pkcs12.c
index 1591bb9623..765d982440 100644
--- a/lib/x509/pkcs12.c
+++ b/lib/x509/pkcs12.c
@@ -1780,8 +1780,10 @@ gnutls_pkcs12_simple_parse(gnutls_pkcs12_t p12,
gnutls_pkcs12_bag_deinit(bag);
if (ret < 0) {
- if (*key)
+ if (*key) {
gnutls_x509_privkey_deinit(*key);
+ *key = NULL;
+ }
if (_extra_certs_len && _extra_certs != NULL) {
for (i = 0; i < _extra_certs_len; i++)
gnutls_x509_crt_deinit(_extra_certs[i]);