summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2023-08-16 12:15:07 +0100
committerTomas Mraz <tomas@openssl.org>2023-08-17 21:35:53 +0200
commit0577dbad0709f1b3717297420069c6160245e74d (patch)
treee8ed2dc97afa5f22f52b618646bd264db0e94106
parent4a469cba27cf778f1d97ddeefd3a3a80cd623553 (diff)
Fix a memory leak in tls_new_record_layer
If setting the crypto state has failed then memory might have been partially allocated to fields within the partially constructed record layer. We need to call tls_int_free() to properly free it. Found by the reproducible error patch in openssl#21668 Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21753)
-rw-r--r--ssl/record/methods/tls_common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ssl/record/methods/tls_common.c b/ssl/record/methods/tls_common.c
index 4cfeddca43..505e133161 100644
--- a/ssl/record/methods/tls_common.c
+++ b/ssl/record/methods/tls_common.c
@@ -1411,7 +1411,7 @@ tls_new_record_layer(OSSL_LIB_CTX *libctx, const char *propq, int vers,
err:
if (ret != OSSL_RECORD_RETURN_SUCCESS) {
- OPENSSL_free(*retrl);
+ tls_int_free(*retrl);
*retrl = NULL;
}
return ret;