From df97319e4c73b867f2b91546b5cf5ffa741cb9d5 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 28 Aug 2016 21:42:34 +0100 Subject: gnutls_pkcs12_simple_parse: set the key value to null on failure --- lib/x509/pkcs12.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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]); -- cgit v1.2.1