From 77d172e3db30cdbecc79024da091903cfa7f349b Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Mon, 7 Sep 2020 10:45:44 +0300 Subject: GmCerts: Suspicious double garbage collection Something fishy going on here. --- src/gmcerts.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/gmcerts.c') diff --git a/src/gmcerts.c b/src/gmcerts.c index b24a6d9c..a39b303a 100644 --- a/src/gmcerts.c +++ b/src/gmcerts.c @@ -368,10 +368,10 @@ iBool checkTrust_GmCerts(iGmCerts *d, iRangecc domain, const iTlsCertificate *ce return iFalse; } /* Good certificate. If not already trusted, add it now. */ - const iString *key = collect_String(newRange_String(domain)); + iString *key = newRange_String(domain); iDate until; validUntil_TlsCertificate(cert, &until); - iBlock *fingerprint = collect_Block(fingerprint_TlsCertificate(cert)); + iBlock *fingerprint = fingerprint_TlsCertificate(cert); lock_Mutex(&d->mtx); iTrustEntry *trust = value_StringHash(d->trusted, key); if (trust) { @@ -383,6 +383,8 @@ iBool checkTrust_GmCerts(iGmCerts *d, iRangecc domain, const iTlsCertificate *ce /* Trusted cert is still valid. */ const iBool isTrusted = cmp_Block(fingerprint, &trust->fingerprint) == 0; unlock_Mutex(&d->mtx); + delete_Block(fingerprint); + delete_String(key); return isTrusted; } /* Update the trusted cert. */ @@ -394,6 +396,8 @@ iBool checkTrust_GmCerts(iGmCerts *d, iRangecc domain, const iTlsCertificate *ce } save_GmCerts_(d); unlock_Mutex(&d->mtx); + delete_Block(fingerprint); + delete_String(key); return iTrue; } -- cgit v1.2.3