mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02: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
@ -4280,6 +4280,8 @@ static int ssl_sess_new_srv_cb(SSL *ssl, SSL_SESSION *sess)
|
|||||||
ptr = s->ssl_ctx.reused_sess[tid].ptr;
|
ptr = s->ssl_ctx.reused_sess[tid].ptr;
|
||||||
} else {
|
} else {
|
||||||
ptr = realloc(s->ssl_ctx.reused_sess[tid].ptr, len);
|
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].ptr = ptr;
|
||||||
s->ssl_ctx.reused_sess[tid].allocated_size = len;
|
s->ssl_ctx.reused_sess[tid].allocated_size = len;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user