[openssl] master update

tomas at openssl.org tomas at openssl.org
Fri Oct 22 09:57:09 UTC 2021


The branch master has been updated
       via  f11c01a666e9d5b97e859cbc74586802549dee00 (commit)
      from  5001287c0dcd8ca4ffc564b360f86df79bba40c1 (commit)


- Log -----------------------------------------------------------------
commit f11c01a666e9d5b97e859cbc74586802549dee00
Author: yuanjungong <yuanjungong96 at gmail.com>
Date:   Wed Sep 1 11:33:34 2021 +0800

    Clean up on failed BIO creation
    
    Reviewed-by: Shane Lontis <shane.lontis at oracle.com>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/16316)

-----------------------------------------------------------------------

Summary of changes:
 apps/openssl.c                | 5 ++++-
 test/testutil/testutil_init.c | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/apps/openssl.c b/apps/openssl.c
index 2693350ffc..e20661277e 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -168,14 +168,17 @@ static void setup_trace_category(int category)
 {
     BIO *channel;
     tracedata *trace_data;
+    BIO *bio = NULL;
 
     if (OSSL_trace_enabled(category))
         return;
 
-    channel = BIO_push(BIO_new(BIO_f_prefix()), dup_bio_err(FORMAT_TEXT));
+    bio = BIO_new(BIO_f_prefix());
+    channel = BIO_push(bio, dup_bio_err(FORMAT_TEXT));
     trace_data = OPENSSL_zalloc(sizeof(*trace_data));
 
     if (trace_data == NULL
+        || bio == NULL
         || (trace_data->bio = channel) == NULL
         || OSSL_trace_set_callback(category, internal_trace_cb,
                                    trace_data) == 0
diff --git a/test/testutil/testutil_init.c b/test/testutil/testutil_init.c
index a91b0e4ba3..3301551ab2 100644
--- a/test/testutil/testutil_init.c
+++ b/test/testutil/testutil_init.c
@@ -71,15 +71,18 @@ static void setup_trace_category(int category)
 {
     BIO *channel;
     tracedata *trace_data;
+    BIO *bio = NULL;
 
     if (OSSL_trace_enabled(category))
         return;
 
-    channel = BIO_push(BIO_new(BIO_f_prefix()),
+    bio = BIO_new(BIO_f_prefix());
+    channel = BIO_push(bio,
                        BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT));
     trace_data = OPENSSL_zalloc(sizeof(*trace_data));
 
     if (trace_data == NULL
+        || bio == NULL
         || (trace_data->bio = channel) == NULL
         || OSSL_trace_set_callback(category, internal_trace_cb,
                                    trace_data) == 0


More information about the openssl-commits mailing list