From: Nikos Mavrogiannopoulos Date: Fri, 12 May 2017 15:58:55 +0000 (+0200) Subject: find_signer: eliminate memory leak X-Git-Tag: gnutls_3_6_0~573 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a526dfbfaca1ef3f35c03f3ddf8a32c802f7f7c9;p=thirdparty%2Fgnutls.git find_signer: eliminate memory leak Signed-off-by: Nikos Mavrogiannopoulos --- 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 */