From 6cd381e590bf28c180c089b47667defe4b6ff3eb Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 11 Jun 2009 19:26:49 +0200 Subject: conntrackd: add missing initialization of PID in process infrastructure In 0374398fd14bf587d80d9d31e361e266e69387c8, I introduced the process infrastructure. However, that patch missed the PID initialization. Without this patch, the process structures are never released. Signed-off-by: Pablo Neira Ayuso --- src/process.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/process.c b/src/process.c index a89f388..70972fe 100644 --- a/src/process.c +++ b/src/process.c @@ -24,6 +24,7 @@ static LIST_HEAD(process_list); int fork_process_new(void (*cb)(void *data), void *data) { struct child_process *c; + int pid; c = calloc(sizeof(struct child_process), 1); if (c == NULL) @@ -31,10 +32,12 @@ int fork_process_new(void (*cb)(void *data), void *data) c->cb = cb; c->data = data; + c->pid = pid = fork(); - list_add(&c->head, &process_list); + if (c->pid > 0) + list_add(&c->head, &process_list); - return fork(); + return pid; } int fork_process_delete(int pid) -- cgit v1.2.3