MINOR: mworker: allocate and initialize a mworker_proc
mworker_proc_new() allocates and initializes correctly a mworker_proc
structure.
diff --git a/src/mworker.c b/src/mworker.c
index fa3c1a2..5d30b18 100644
--- a/src/mworker.c
+++ b/src/mworker.c
@@ -128,6 +128,25 @@
setenv("HAPROXY_PROCESSES", msg, 1);
}
+struct mworker_proc *mworker_proc_new()
+{
+ struct mworker_proc *child;
+
+ child = calloc(1, sizeof(*child));
+ if (!child)
+ return NULL;
+
+ child->failedreloads = 0;
+ child->reloads = 0;
+ child->pid = -1;
+ child->ipc_fd[0] = -1;
+ child->ipc_fd[1] = -1;
+ child->timestamp = -1;
+
+ return child;
+}
+
+
/*
* unserialize the proc list from the environment
*/
@@ -147,7 +166,7 @@
msg = NULL;
- child = calloc(1, sizeof(*child));
+ child = mworker_proc_new();
if (!child) {
ha_alert("Out of memory while trying to allocate a worker process structure.");
return -1;