]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: mworker: remove duplicate pointer tests in cfg_parse_program()
authorWilly Tarreau <w@1wt.eu>
Tue, 5 Jan 2021 14:58:37 +0000 (15:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 5 Jan 2021 14:58:37 +0000 (15:58 +0100)
As reported in issue #1017, there are two harmless duplicate tests in
cfg_parse_program(), one made of a "if" using the same condition as the
loop it's in, and the other one being a null test before a free. This
just removes them. No backport is needed.

src/mworker-prog.c

index 8d404cb519d84edeb75db3b6bb90b699b6b10275..acf84b0e4ef119835c627d1f0b5ce78eec024d8e 100644 (file)
@@ -307,18 +307,14 @@ error:
                        int i;
 
                        for (i = 0; ext_child->command[i]; i++) {
-                               if (ext_child->command[i]) {
-                                       free(ext_child->command[i]);
-                                       ext_child->command[i] = NULL;
-                               }
+                               free(ext_child->command[i]);
+                               ext_child->command[i] = NULL;
                        }
                        free(ext_child->command);
                        ext_child->command = NULL;
                }
-               if (ext_child->id) {
-                       free(ext_child->id);
-                       ext_child->id = NULL;
-               }
+               free(ext_child->id);
+               ext_child->id = NULL;
        }
 
        free(ext_child);