summaryrefslogtreecommitdiffstats
path: root/test/helpers
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2023-09-20 17:24:37 +0200
committerMatt Caswell <matt@openssl.org>2023-09-22 14:56:43 +0200
commitf13f9b716e8b148b97dbe49e823b9dc3f235de1f (patch)
treec1a189fd1b2ebd97b916213661c781759f5ff23f /test/helpers
parentRemove some redundant code from test helper BIOs (diff)
downloadopenssl-f13f9b716e8b148b97dbe49e823b9dc3f235de1f.tar.xz
openssl-f13f9b716e8b148b97dbe49e823b9dc3f235de1f.zip
Ensure we up-ref the sbio before passing it to tserver
We are actually passing two references to sbio: one as part of a BIO chain and one stand alone. Therefore we need two references. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22157)
Diffstat (limited to 'test/helpers')
-rw-r--r--test/helpers/quictestlib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/helpers/quictestlib.c b/test/helpers/quictestlib.c
index 6a72cc27be..f5a46efb6f 100644
--- a/test/helpers/quictestlib.c
+++ b/test/helpers/quictestlib.c
@@ -201,8 +201,12 @@ int qtest_create_quic_objects(OSSL_LIB_CTX *libctx, SSL_CTX *clientctx,
BIO_set_data(fisbio, fault == NULL ? NULL : *fault);
- if (!TEST_ptr(BIO_push(fisbio, sbio)))
+ if (!BIO_up_ref(sbio))
goto err;
+ if (!TEST_ptr(BIO_push(fisbio, sbio))) {
+ BIO_free(sbio);
+ goto err;
+ }
tserver_args.libctx = libctx;
tserver_args.net_rbio = sbio;
@@ -240,7 +244,7 @@ int qtest_create_quic_objects(OSSL_LIB_CTX *libctx, SSL_CTX *clientctx,
SSL_CTX_free(tserver_args.ctx);
BIO_ADDR_free(peeraddr);
BIO_free_all(cbio);
- BIO_free(fisbio);
+ BIO_free_all(fisbio);
BIO_free_all(sbio);
SSL_free(*cssl);
*cssl = NULL;