mirror of
https://github.com/haproxy/haproxy.git
synced 2026-06-07 15:52:10 -04:00
BUG/MINOR: ssl_sock: fix possible memory leak on OOM
That's the classical realloc() issue: if it returns NULL, the old area
is not freed but we erase the pointer. It was brought by commit e18d4e828
("BUG/MEDIUM: ssl: backend TLS resumption with sni and TLSv1.3"), and
should be backported where this commit was backported.
This commit is contained in:
parent
7e9aea789f
commit
ff9e653859
1 changed files with 2 additions and 0 deletions
|
|
@ -4280,6 +4280,8 @@ static int ssl_sess_new_srv_cb(SSL *ssl, SSL_SESSION *sess)
|
|||
ptr = s->ssl_ctx.reused_sess[tid].ptr;
|
||||
} else {
|
||||
ptr = realloc(s->ssl_ctx.reused_sess[tid].ptr, len);
|
||||
if (!ptr)
|
||||
free(s->ssl_ctx.reused_sess[tid].ptr);
|
||||
s->ssl_ctx.reused_sess[tid].ptr = ptr;
|
||||
s->ssl_ctx.reused_sess[tid].allocated_size = len;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue