diff options
author | tb <> | 2024-03-22 06:24:54 +0000 |
---|---|---|
committer | tb <> | 2024-03-22 06:24:54 +0000 |
commit | c5b3d1215f4c7d01189ebf4a89d9b4a56d351c44 (patch) | |
tree | 656e3fe164204e9059e125a8ecb068a89ef0e8be /src | |
parent | 9b3cd1284ddf3be25652b2a2e7368ba8b34872a5 (diff) | |
download | openbsd-c5b3d1215f4c7d01189ebf4a89d9b4a56d351c44.tar.gz openbsd-c5b3d1215f4c7d01189ebf4a89d9b4a56d351c44.tar.bz2 openbsd-c5b3d1215f4c7d01189ebf4a89d9b4a56d351c44.zip |
Simplify X509_STORE_free()
This had an inlined version of sk_pop_free(). We can just call it the
right way.
ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/x509/x509_lu.c | 14 |
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 | ||
68 | static X509_LOOKUP * | 69 | static X509_LOOKUP * |
@@ -221,22 +222,13 @@ x509_object_dup(const X509_OBJECT *obj) | |||
221 | void | 222 | void |
222 | X509_STORE_free(X509_STORE *store) | 223 | X509_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); |