CLEANUP: Stop checking the pointer before calling `task_free()`
Changes performed with this Coccinelle patch: @@ expression e; @@ - if (e != NULL) { task_destroy(e); - } @@ expression e; @@ - if (e) { task_destroy(e); - } @@ expression e; @@ - if (e) task_destroy(e); @@ expression e; @@ - if (e != NULL) task_destroy(e);
This commit is contained in:
parent
c18e244515
commit
fe83f58906
|
@ -2451,8 +2451,7 @@ static void deinit_idle_conns(void)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < global.nbthread; i++) {
|
||||
if (idle_conns[i].cleanup_task)
|
||||
task_destroy(idle_conns[i].cleanup_task);
|
||||
task_destroy(idle_conns[i].cleanup_task);
|
||||
}
|
||||
}
|
||||
REGISTER_POST_DEINIT(deinit_idle_conns);
|
||||
|
|
|
@ -779,8 +779,7 @@ void dns_session_free(struct dns_session *ds)
|
|||
{
|
||||
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);
|
||||
task_destroy(ds->task_exp);
|
||||
|
||||
dns_queries_flush(ds);
|
||||
|
||||
|
@ -1080,8 +1079,7 @@ struct dns_session *dns_session_new(struct dns_stream_server *dss)
|
|||
return ds;
|
||||
|
||||
error:
|
||||
if (ds->task_exp)
|
||||
task_destroy(ds->task_exp);
|
||||
task_destroy(ds->task_exp);
|
||||
pool_free(dns_msg_buf, ds->rx_msg.area);
|
||||
pool_free(dns_msg_buf, ds->tx_ring_area);
|
||||
|
||||
|
|
|
@ -9257,8 +9257,7 @@ static struct event_hdl_sub *hlua_event_subscribe(event_hdl_sub_list *list, stru
|
|||
|
||||
mem_error:
|
||||
if (hlua_sub) {
|
||||
if (hlua_sub->task)
|
||||
task_destroy(hlua_sub->task);
|
||||
task_destroy(hlua_sub->task);
|
||||
if (hlua_sub->hlua)
|
||||
hlua_ctx_destroy(hlua_sub->hlua);
|
||||
pool_free(pool_head_hlua_event_sub, hlua_sub);
|
||||
|
|
|
@ -502,8 +502,7 @@ void mworker_cleanlisteners()
|
|||
/* disable this peer section so that it kills itself */
|
||||
if (curpeers->sighandler)
|
||||
signal_unregister_handler(curpeers->sighandler);
|
||||
if (curpeers->sync_task)
|
||||
task_destroy(curpeers->sync_task);
|
||||
task_destroy(curpeers->sync_task);
|
||||
curpeers->sync_task = NULL;
|
||||
curpeers->peers_fe = NULL;
|
||||
}
|
||||
|
|
|
@ -2491,10 +2491,8 @@ static void resolvers_destroy(struct resolvers *resolvers)
|
|||
if (ns->stream) {
|
||||
if (ns->stream->ring_req)
|
||||
ring_free(ns->stream->ring_req);
|
||||
if (ns->stream->task_req)
|
||||
task_destroy(ns->stream->task_req);
|
||||
if (ns->stream->task_rsp)
|
||||
task_destroy(ns->stream->task_rsp);
|
||||
task_destroy(ns->stream->task_req);
|
||||
task_destroy(ns->stream->task_rsp);
|
||||
free(ns->stream);
|
||||
}
|
||||
LIST_DEL_INIT(&ns->list);
|
||||
|
|
Loading…
Reference in New Issue