From: William Lallemand Date: Thu, 27 Jan 2022 14:33:40 +0000 (+0100) Subject: CLEANUP: mworker: simplify mworker_free_child() X-Git-Tag: v2.6-dev1~68 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=08cb945a9b67a8b45cf8d213496c5847957e2f2e;p=thirdparty%2Fhaproxy.git CLEANUP: mworker: simplify mworker_free_child() Remove useless checks and simplify the function. --- diff --git a/src/mworker.c b/src/mworker.c index ac1177f4c8..8b0b06ba02 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -603,26 +603,17 @@ out: void mworker_free_child(struct mworker_proc *child) { + int i; + if (child == NULL) return; - if (child->command) { - int i; - - for (i = 0; child->command[i]; i++) { - if (child->command[i]) { - ha_free(&child->command[i]); - } + for (i = 0; child->command && child->command[i]; i++) + ha_free(&child->command[i]); - } - ha_free(&child->command); - } - if (child->id) { - ha_free(&child->id); - } - if (child->version) { - ha_free(&child->version); - } + ha_free(&child->command); + ha_free(&child->id); + ha_free(&child->version); free(child); }