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)
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;
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;