summaryrefslogtreecommitdiff
path: root/src/gmcerts.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-09-07 10:45:44 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-09-07 10:45:44 +0300
commit77d172e3db30cdbecc79024da091903cfa7f349b (patch)
tree53c043863a44c869ddb7140a3d2d68c814621807 /src/gmcerts.c
parent49c7cc84b04c5a2bb15696f3de532d38573be028 (diff)
GmCerts: Suspicious double garbage collection
Something fishy going on here.
Diffstat (limited to 'src/gmcerts.c')
-rw-r--r--src/gmcerts.c8
1 files changed, 6 insertions, 2 deletions
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
368 return iFalse; 368 return iFalse;
369 } 369 }
370 /* Good certificate. If not already trusted, add it now. */ 370 /* Good certificate. If not already trusted, add it now. */
371 const iString *key = collect_String(newRange_String(domain)); 371 iString *key = newRange_String(domain);
372 iDate until; 372 iDate until;
373 validUntil_TlsCertificate(cert, &until); 373 validUntil_TlsCertificate(cert, &until);
374 iBlock *fingerprint = collect_Block(fingerprint_TlsCertificate(cert)); 374 iBlock *fingerprint = fingerprint_TlsCertificate(cert);
375 lock_Mutex(&d->mtx); 375 lock_Mutex(&d->mtx);
376 iTrustEntry *trust = value_StringHash(d->trusted, key); 376 iTrustEntry *trust = value_StringHash(d->trusted, key);
377 if (trust) { 377 if (trust) {
@@ -383,6 +383,8 @@ iBool checkTrust_GmCerts(iGmCerts *d, iRangecc domain, const iTlsCertificate *ce
383 /* Trusted cert is still valid. */ 383 /* Trusted cert is still valid. */
384 const iBool isTrusted = cmp_Block(fingerprint, &trust->fingerprint) == 0; 384 const iBool isTrusted = cmp_Block(fingerprint, &trust->fingerprint) == 0;
385 unlock_Mutex(&d->mtx); 385 unlock_Mutex(&d->mtx);
386 delete_Block(fingerprint);
387 delete_String(key);
386 return isTrusted; 388 return isTrusted;
387 } 389 }
388 /* Update the trusted cert. */ 390 /* Update the trusted cert. */
@@ -394,6 +396,8 @@ iBool checkTrust_GmCerts(iGmCerts *d, iRangecc domain, const iTlsCertificate *ce
394 } 396 }
395 save_GmCerts_(d); 397 save_GmCerts_(d);
396 unlock_Mutex(&d->mtx); 398 unlock_Mutex(&d->mtx);
399 delete_Block(fingerprint);
400 delete_String(key);
397 return iTrue; 401 return iTrue;
398} 402}
399 403