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_1_1_1m~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f8b8045e6b9a7780873c28c569a8a6388e11306;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) (cherry picked from commit 34563be5368fb8e6ade7d06d8376522ba83cd6ac) --- diff --git a/test/ssltest_old.c b/test/ssltest_old.c index cc98e4f8665..b6e21e4e18d 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);