From: tb Date: Fri, 22 Mar 2024 06:24:54 +0000 (+0000) Subject: Simplify X509_STORE_free() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=eeb276dfee031771095d62f976689174e966054b;p=openbsd Simplify X509_STORE_free() This had an inlined version of sk_pop_free(). We can just call it the right way. ok jsing --- diff --git a/lib/libcrypto/x509/x509_lu.c b/lib/libcrypto/x509/x509_lu.c index 56fb439996e..0edcfca7d19 100644 --- a/lib/libcrypto/x509/x509_lu.c +++ b/lib/libcrypto/x509/x509_lu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_lu.c,v 1.64 2024/03/02 10:57:03 tb Exp $ */ +/* $OpenBSD: x509_lu.c,v 1.65 2024/03/22 06:24:54 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -63,6 +63,7 @@ #include #include #include + #include "x509_local.h" static X509_LOOKUP * @@ -221,22 +222,13 @@ x509_object_dup(const X509_OBJECT *obj) void X509_STORE_free(X509_STORE *store) { - STACK_OF(X509_LOOKUP) *sk; - X509_LOOKUP *lu; - int i; - if (store == NULL) return; if (CRYPTO_add(&store->references, -1, CRYPTO_LOCK_X509_STORE) > 0) return; - sk = store->get_cert_methods; - for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) { - lu = sk_X509_LOOKUP_value(sk, i); - X509_LOOKUP_free(lu); - } - sk_X509_LOOKUP_free(sk); + sk_X509_LOOKUP_pop_free(store->get_cert_methods, X509_LOOKUP_free); sk_X509_OBJECT_pop_free(store->objs, X509_OBJECT_free); CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE, store, &store->ex_data);