Skip to content

Commit

Permalink
Fix memory leak in tls_parse_ctos_psk()
Browse files Browse the repository at this point in the history
`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ý <[email protected]>
Reviewed-by: Tom Cosgrove <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#25643)

(cherry picked from commit b2474b2)
  • Loading branch information
nielsdos authored and t8m committed Oct 11, 2024
1 parent 3f560b2 commit 32f06c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ssl/statem/extensions_srvr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,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;
Expand Down

0 comments on commit 32f06c5

Please sign in to comment.