]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker: calloc mworker_proc structures
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 1 Apr 2019 09:29:58 +0000 (11:29 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 1 Apr 2019 12:45:37 +0000 (14:45 +0200)
Initialize mworker_proc structures to 0 with calloc instead of just
doing a malloc.

src/haproxy.c

index 3cc5c9ca509d591a0c8162c4072689ec9cc01853..77efdd50c9c717fe4642592fe83de28064143b92 100644 (file)
@@ -1599,7 +1599,7 @@ static void init(int argc, char **argv)
 
                if (getenv("HAPROXY_MWORKER_REEXEC") == NULL) {
 
-                       tmproc = malloc(sizeof(*tmproc));
+                       tmproc = calloc(1, sizeof(*tmproc));
                        if (!tmproc) {
                                ha_alert("Cannot allocate process structures.\n");
                                exit(EXIT_FAILURE);
@@ -1619,7 +1619,7 @@ static void init(int argc, char **argv)
 
                for (proc = 0; proc < global.nbproc; proc++) {
 
-                       tmproc = malloc(sizeof(*tmproc));
+                       tmproc = calloc(1, sizeof(*tmproc));
                        if (!tmproc) {
                                ha_alert("Cannot allocate process structures.\n");
                                exit(EXIT_FAILURE);