From 34563be5368fb8e6ade7d06d8376522ba83cd6ac Mon Sep 17 00:00:00 2001 From: Peiwei Hu Date: Tue, 12 Oct 2021 10:50:12 +0800 Subject: [PATCH] test/ssl_old_test.c: Fix potential leak Reviewed-by: Kurt Roeckx Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/16806) --- test/ssl_old_test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/ssl_old_test.c b/test/ssl_old_test.c index 60a275a014a..3ccc8e06e4c 100644 --- a/test/ssl_old_test.c +++ b/test/ssl_old_test.c @@ -829,12 +829,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); -- 2.47.2