]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: mworker: simplify mworker_free_child()
authorWilliam Lallemand <wlallemand@haproxy.org>
Thu, 27 Jan 2022 14:33:40 +0000 (15:33 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Thu, 27 Jan 2022 14:33:40 +0000 (15:33 +0100)
Remove useless checks and simplify the function.

src/mworker.c

index ac1177f4c81310cdb6c9e8ceaa1eaf3ffb044376..8b0b06ba029f7a29167d5afb2ecc72e15f8e8c42 100644 (file)
@@ -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);
 }