summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPeiwei Hu <jlu.hpw@foxmail.com>2021-10-12 10:50:12 +0800
committerTomas Mraz <tomas@openssl.org>2021-10-15 08:56:58 +0200
commit2f8b8045e6b9a7780873c28c569a8a6388e11306 (patch)
tree487cabb69ea534bb082f432916b998f11b1bda14 /test
parentbf07844312caf4ac251f5303993230c254e7c771 (diff)
test/ssl_old_test.c: Fix potential leak
Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16806) (cherry picked from commit 34563be5368fb8e6ade7d06d8376522ba83cd6ac)
Diffstat (limited to 'test')
-rw-r--r--test/ssltest_old.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/ssltest_old.c b/test/ssltest_old.c
index cc98e4f866..b6e21e4e18 100644
--- a/test/ssltest_old.c
+++ b/test/ssltest_old.c
@@ -841,12 +841,14 @@ static SSL_SESSION *read_session(const char *filename)
static int write_session(const char *filename, SSL_SESSION *sess)
{
- BIO *f = BIO_new_file(filename, "w");
+ BIO *f;
if (sess == NULL) {
BIO_printf(bio_err, "No session information\n");
return 0;
}
+
+ f = BIO_new_file(filename, "w");
if (f == NULL) {
BIO_printf(bio_err, "Can't open session file %s\n", filename);
ERR_print_errors(bio_err);