Skip to content

Commit a559a4a

Browse files
committed
PKCS7 trust store: properly clean certificates
Signed-off-by: Stephan Mueller <smueller@chronox.de>
1 parent b7cabed commit a559a4a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

asn1/src/pkcs7_trust.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ LC_INTERFACE_FUNCTION(int, lc_pkcs7_trust_store_add,
338338
LC_INTERFACE_FUNCTION(void, lc_pkcs7_trust_store_clear,
339339
struct lc_pkcs7_trust_store *trust_store)
340340
{
341-
struct lc_x509_certificate *anchor_cert;
341+
struct lc_x509_certificate *anchor_cert, *tmp;
342342

343343
if (!trust_store) {
344344
/* Trust store is empty, nothing to do */
@@ -348,8 +348,8 @@ LC_INTERFACE_FUNCTION(void, lc_pkcs7_trust_store_clear,
348348
anchor_cert = trust_store->anchor_cert;
349349

350350
while (anchor_cert) {
351-
lc_x509_cert_clear(anchor_cert);
352-
351+
tmp = anchor_cert;
353352
anchor_cert = anchor_cert->next;
353+
lc_x509_cert_clear(tmp);
354354
}
355355
}

0 commit comments

Comments
 (0)