summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/x509/x509_lu.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/lib/libcrypto/x509/x509_lu.c b/src/lib/libcrypto/x509/x509_lu.c
index 56fb439996..0edcfca7d1 100644
--- a/src/lib/libcrypto/x509/x509_lu.c
+++ b/src/lib/libcrypto/x509/x509_lu.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_lu.c,v 1.64 2024/03/02 10:57:03 tb Exp $ */ 1/* $OpenBSD: x509_lu.c,v 1.65 2024/03/22 06:24:54 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -63,6 +63,7 @@
63#include <openssl/lhash.h> 63#include <openssl/lhash.h>
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
66
66#include "x509_local.h" 67#include "x509_local.h"
67 68
68static X509_LOOKUP * 69static X509_LOOKUP *
@@ -221,22 +222,13 @@ x509_object_dup(const X509_OBJECT *obj)
221void 222void
222X509_STORE_free(X509_STORE *store) 223X509_STORE_free(X509_STORE *store)
223{ 224{
224 STACK_OF(X509_LOOKUP) *sk;
225 X509_LOOKUP *lu;
226 int i;
227
228 if (store == NULL) 225 if (store == NULL)
229 return; 226 return;
230 227
231 if (CRYPTO_add(&store->references, -1, CRYPTO_LOCK_X509_STORE) > 0) 228 if (CRYPTO_add(&store->references, -1, CRYPTO_LOCK_X509_STORE) > 0)
232 return; 229 return;
233 230
234 sk = store->get_cert_methods; 231 sk_X509_LOOKUP_pop_free(store->get_cert_methods, X509_LOOKUP_free);
235 for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
236 lu = sk_X509_LOOKUP_value(sk, i);
237 X509_LOOKUP_free(lu);
238 }
239 sk_X509_LOOKUP_free(sk);
240 sk_X509_OBJECT_pop_free(store->objs, X509_OBJECT_free); 232 sk_X509_OBJECT_pop_free(store->objs, X509_OBJECT_free);
241 233
242 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE, store, &store->ex_data); 234 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE, store, &store->ex_data);