mirror of
https://github.com/haproxy/haproxy.git
synced 2026-02-19 02:29:31 -05:00
CLEANUP: ssl: use realloc() instead of free()+malloc()
There was a free(ptr) followed by ptr=malloc(ptr, len), which is the equivalent of ptr = realloc(ptr, len) but slower and less clean. Let's replace this.
This commit is contained in:
parent
e709e82173
commit
3bda3f422e
1 changed files with 2 additions and 2 deletions
|
|
@ -3996,8 +3996,8 @@ static int ssl_sess_new_srv_cb(SSL *ssl, SSL_SESSION *sess)
|
|||
if (s->ssl_ctx.reused_sess[tid].ptr && s->ssl_ctx.reused_sess[tid].allocated_size >= len) {
|
||||
ptr = s->ssl_ctx.reused_sess[tid].ptr;
|
||||
} else {
|
||||
free(s->ssl_ctx.reused_sess[tid].ptr);
|
||||
ptr = s->ssl_ctx.reused_sess[tid].ptr = malloc(len);
|
||||
ptr = realloc(s->ssl_ctx.reused_sess[tid].ptr, len);
|
||||
s->ssl_ctx.reused_sess[tid].ptr = ptr;
|
||||
s->ssl_ctx.reused_sess[tid].allocated_size = len;
|
||||
}
|
||||
if (s->ssl_ctx.reused_sess[tid].ptr) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue