CLEANUP: Stop checking the pointer before calling `tasklet_free()`
Changes performed with this Coccinelle patch:
@@
expression e;
@@
- if (e != NULL) {
tasklet_free(e);
- }
@@
expression e;
@@
- if (e) {
tasklet_free(e);
- }
@@
expression e;
@@
- if (e)
tasklet_free(e);
@@
expression e;
@@
- if (e != NULL)
tasklet_free(e);
See GitHub Issue #2126
diff --git a/src/stconn.c b/src/stconn.c
index 59d2179..8458331 100644
--- a/src/stconn.c
+++ b/src/stconn.c
@@ -231,8 +231,7 @@
BUG_ON(!sc_ep_test(sc, SE_FL_DETACHED));
sedesc_free(sc->sedesc);
}
- if (sc->wait_event.tasklet)
- tasklet_free(sc->wait_event.tasklet);
+ tasklet_free(sc->wait_event.tasklet);
pool_free(pool_head_connstream, sc);
}
@@ -417,8 +416,7 @@
sockaddr_free(&sc->src);
sockaddr_free(&sc->dst);
- if (sc->wait_event.tasklet)
- tasklet_free(sc->wait_event.tasklet);
+ tasklet_free(sc->wait_event.tasklet);
sc->wait_event.tasklet = NULL;
sc->wait_event.events = 0;
sc_free_cond(scp);