If an error occurs constructing the quic record layer, free it properly

We need to call quic_free() to free the record layer to ensure than any
BIO that was already set is also freed.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22368)
This commit is contained in:
Matt Caswell 2023-10-13 16:33:31 +01:00
parent d8bf5ea19d
commit d8a4451fa7

View File

@ -85,6 +85,7 @@ struct ossl_record_layer_st {
};
static int quic_set1_bio(OSSL_RECORD_LAYER *rl, BIO *bio);
static int quic_free(OSSL_RECORD_LAYER *r);
static int
quic_new_record_layer(OSSL_LIB_CTX *libctx, const char *propq, int vers,
@ -189,7 +190,7 @@ quic_new_record_layer(OSSL_LIB_CTX *libctx, const char *propq, int vers,
return 1;
err:
*retrl = NULL;
OPENSSL_free(rl);
quic_free(rl);
return 0;
}