From: Peiwei Hu Date: Tue, 12 Oct 2021 02:50:12 +0000 (+0800) Subject: test/ssl_old_test.c: Fix potential leak X-Git-Tag: openssl-3.2.0-alpha1~3466 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=34563be5368fb8e6ade7d06d8376522ba83cd6ac;p=thirdparty%2Fopenssl.git 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) --- 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);