Mbed TLS before 3.0.1 has a double free in certain out-of-memory conditions, as demonstrated by an mbedtls_ssl_set_session() failure.
https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2021-12
https://lists.debian.org/debian-lts-announce/2022/12/msg00036.html
https://github.com/ARMmbed/mbedtls/releases/tag/v3.1.0
https://github.com/ARMmbed/mbedtls/releases/tag/v2.28.0
https://github.com/ARMmbed/mbedtls/releases/tag/v2.16.12