Fix a memory leak on successful load of CRL
Fixes #23693 Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23695)
This commit is contained in:
parent
8d8866aff3
commit
6134e8e6dd
@ -198,6 +198,8 @@ int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
X509_CRL_free(x);
|
||||||
|
x = NULL;
|
||||||
}
|
}
|
||||||
} else if (type == X509_FILETYPE_ASN1) {
|
} else if (type == X509_FILETYPE_ASN1) {
|
||||||
x = d2i_X509_CRL_bio(in, NULL);
|
x = d2i_X509_CRL_bio(in, NULL);
|
||||||
|
@ -12,4 +12,5 @@ setup("test_load_cert_file");
|
|||||||
|
|
||||||
plan tests => 1;
|
plan tests => 1;
|
||||||
|
|
||||||
ok(run(test(["x509_load_cert_file_test", srctop_file("test", "certs", "leaf-chain.pem")])));
|
ok(run(test(["x509_load_cert_file_test", srctop_file("test", "certs", "leaf-chain.pem"),
|
||||||
|
srctop_file("test", "certs", "cyrillic_crl.pem")])));
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "testutil.h"
|
#include "testutil.h"
|
||||||
|
|
||||||
static const char *chain;
|
static const char *chain;
|
||||||
|
static const char *crl;
|
||||||
|
|
||||||
static int test_load_cert_file(void)
|
static int test_load_cert_file(void)
|
||||||
{
|
{
|
||||||
@ -36,6 +37,9 @@ static int test_load_cert_file(void)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (crl != NULL && !TEST_true(X509_load_crl_file(lookup, crl, X509_FILETYPE_PEM)))
|
||||||
|
goto err;
|
||||||
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
@ -45,7 +49,7 @@ err:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
OPT_TEST_DECLARE_USAGE("cert.pem...\n")
|
OPT_TEST_DECLARE_USAGE("cert.pem [crl.pem]\n")
|
||||||
|
|
||||||
int setup_tests(void)
|
int setup_tests(void)
|
||||||
{
|
{
|
||||||
@ -58,6 +62,8 @@ int setup_tests(void)
|
|||||||
if (chain == NULL)
|
if (chain == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
crl = test_get_argument(1);
|
||||||
|
|
||||||
ADD_TEST(test_load_cert_file);
|
ADD_TEST(test_load_cert_file);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user