summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorNiels Dossche <7771979+nielsdos@users.noreply.github.com>2024-10-09 15:42:37 +0200
committerTomas Mraz <tomas@openssl.org>2024-10-11 14:54:03 +0200
commitb2474b287fbc7a24f0aa15e6808c6e3ef8287f23 (patch)
tree446078b3ec79b3ed098883fc23dc28aaf8630349 /ssl
parentfipsinstall: Save the 'status indicator' if the FIPS provider is 3.0.X. (diff)
downloadopenssl-b2474b287fbc7a24f0aa15e6808c6e3ef8287f23.tar.xz
openssl-b2474b287fbc7a24f0aa15e6808c6e3ef8287f23.zip
Fix memory leak in tls_parse_ctos_psk()
`sess` is not NULL at this point, and is freed on the success path, but not on the error path. Fix this by going to the `err` label such that `SSL_SESSION_free(sess)` is called. CLA: trivial Reviewed-by: Saša Nedvědický <sashan@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/25643)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/statem/extensions_srvr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ssl/statem/extensions_srvr.c b/ssl/statem/extensions_srvr.c
index cb143aa843..5d91d3893f 100644
--- a/ssl/statem/extensions_srvr.c
+++ b/ssl/statem/extensions_srvr.c
@@ -1121,7 +1121,7 @@ int tls_parse_ctos_psk(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
if (sesstmp == NULL) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
- return 0;
+ goto err;
}
SSL_SESSION_free(sess);
sess = sesstmp;