aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/x509/x509_lu.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2015-04-30 17:33:59 -0400
committerRich Salz <rsalz@openssl.org>2015-04-30 17:33:59 -0400
commit222561fe8ef510f336417a666f69f81ddc9b8fe4 (patch)
tree70bc6af70550022bc7b7af45bd3c6d64d7fc2680 /crypto/x509/x509_lu.c
parent2ace745022f5af0709297e96eb0b0829c87c4291 (diff)
downloadopenssl-222561fe8ef510f336417a666f69f81ddc9b8fe4.tar.gz
free NULL cleanup 5a
Don't check for NULL before calling a free routine. This gets X509_.*free: x509_name_ex_free X509_policy_tree_free X509_VERIFY_PARAM_free X509_STORE_free X509_STORE_CTX_free X509_PKEY_free X509_OBJECT_free_contents X509_LOOKUP_free X509_INFO_free Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/x509/x509_lu.c')
-rw-r--r--crypto/x509/x509_lu.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c
index 08bbc3988b..7fbc8e364f 100644
--- a/crypto/x509/x509_lu.c
+++ b/crypto/x509/x509_lu.c
@@ -217,6 +217,8 @@ X509_STORE *X509_STORE_new(void)
static void cleanup(X509_OBJECT *a)
{
+ if (!a)
+ return;
if (a->type == X509_LU_X509) {
X509_free(a->data.x509);
} else if (a->type == X509_LU_CRL) {
@@ -260,8 +262,7 @@ void X509_STORE_free(X509_STORE *vfy)
sk_X509_OBJECT_pop_free(vfy->objs, cleanup);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE, vfy, &vfy->ex_data);
- if (vfy->param)
- X509_VERIFY_PARAM_free(vfy->param);
+ X509_VERIFY_PARAM_free(vfy->param);
OPENSSL_free(vfy);
}
@@ -413,6 +414,8 @@ void X509_OBJECT_up_ref_count(X509_OBJECT *a)
void X509_OBJECT_free_contents(X509_OBJECT *a)
{
+ if (!a)
+ return;
switch (a->type) {
case X509_LU_X509:
X509_free(a->data.x509);