mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
CLEANUP: Stop checking the pointer before calling pool_free()
Changes performed with this Coccinelle patch: @@ expression e; expression p; @@ - if (e != NULL) { pool_free(p, e); - } @@ expression e; expression p; @@ - if (e) { pool_free(p, e); - } @@ expression e; expression p; @@ - if (e) pool_free(p, e); @@ expression e; expression p; @@ - if (e != NULL) pool_free(p, e);
This commit is contained in:
parent
b1ec21d259
commit
c18e244515
12
src/dns.c
12
src/dns.c
@ -777,10 +777,8 @@ void dns_queries_flush(struct dns_session *ds)
|
||||
|
||||
void dns_session_free(struct dns_session *ds)
|
||||
{
|
||||
if (ds->rx_msg.area)
|
||||
pool_free(dns_msg_buf, ds->rx_msg.area);
|
||||
if (ds->tx_ring_area)
|
||||
pool_free(dns_msg_buf, ds->tx_ring_area);
|
||||
pool_free(dns_msg_buf, ds->rx_msg.area);
|
||||
pool_free(dns_msg_buf, ds->tx_ring_area);
|
||||
if (ds->task_exp)
|
||||
task_destroy(ds->task_exp);
|
||||
|
||||
@ -1084,10 +1082,8 @@ struct dns_session *dns_session_new(struct dns_stream_server *dss)
|
||||
error:
|
||||
if (ds->task_exp)
|
||||
task_destroy(ds->task_exp);
|
||||
if (ds->rx_msg.area)
|
||||
pool_free(dns_msg_buf, ds->rx_msg.area);
|
||||
if (ds->tx_ring_area)
|
||||
pool_free(dns_msg_buf, ds->tx_ring_area);
|
||||
pool_free(dns_msg_buf, ds->rx_msg.area);
|
||||
pool_free(dns_msg_buf, ds->tx_ring_area);
|
||||
|
||||
pool_free(dns_session_pool, ds);
|
||||
|
||||
|
@ -569,8 +569,7 @@ struct event_hdl_sub *event_hdl_subscribe_ptr(event_hdl_sub_list *sub_list,
|
||||
if (new_sub) {
|
||||
if (hdl.async == EVENT_HDL_ASYNC_MODE_NORMAL) {
|
||||
tasklet_free(new_sub->hdl.async_task);
|
||||
if (task_ctx)
|
||||
pool_free(pool_head_sub_taskctx, task_ctx);
|
||||
pool_free(pool_head_sub_taskctx, task_ctx);
|
||||
}
|
||||
if (hdl.async)
|
||||
pool_free(pool_head_sub_event, new_sub->async_end);
|
||||
|
@ -278,8 +278,7 @@ static struct quic_dgram *quic_rxbuf_purge_dgrams(struct quic_receiver_buf *buf)
|
||||
b_del(&buf->buf, cur->len);
|
||||
|
||||
/* Free last found unused datagram. */
|
||||
if (prev)
|
||||
pool_free(pool_head_quic_dgram, prev);
|
||||
pool_free(pool_head_quic_dgram, prev);
|
||||
prev = cur;
|
||||
}
|
||||
|
||||
|
@ -1466,8 +1466,7 @@ static int resolv_validate_dns_response(unsigned char *resp, unsigned char *bufe
|
||||
tmp_record->ar_item == NULL &&
|
||||
memcmp(tmp_record->data.target, answer_record->name, tmp_record->data_len) == 0) {
|
||||
/* Always use the received additional record to refresh info */
|
||||
if (tmp_record->ar_item)
|
||||
pool_free(resolv_answer_item_pool, tmp_record->ar_item);
|
||||
pool_free(resolv_answer_item_pool, tmp_record->ar_item);
|
||||
tmp_record->ar_item = answer_record;
|
||||
answer_record = NULL;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user