summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/x509/pkcs7.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/x509/pkcs7.c b/lib/x509/pkcs7.c
index 640f7a4c68..e285546060 100644
--- a/lib/x509/pkcs7.c
+++ b/lib/x509/pkcs7.c
@@ -1323,8 +1323,11 @@ gnutls_x509_crt_t find_signer(gnutls_pkcs7_t pkcs7, gnutls_x509_trust_list_t tl,
issuer = find_verified_issuer_of(pkcs7, issuer, purpose, vflags);
- if (issuer != NULL && gnutls_x509_crt_check_issuer(issuer, issuer))
+ if (issuer != NULL && gnutls_x509_crt_check_issuer(issuer, issuer)) {
+ if (prev) gnutls_x509_crt_deinit(prev);
+ prev = issuer;
break;
+ }
} while(issuer != NULL);
issuer = prev; /* the last we have seen */