summaryrefslogtreecommitdiff
path: root/src/irmd/proc_table.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/irmd/proc_table.c')
-rw-r--r--src/irmd/proc_table.c55
1 files changed, 30 insertions, 25 deletions
diff --git a/src/irmd/proc_table.c b/src/irmd/proc_table.c
index 6f9d8e20..27fbb505 100644
--- a/src/irmd/proc_table.c
+++ b/src/irmd/proc_table.c
@@ -50,41 +50,44 @@ struct proc_entry * proc_entry_create(pid_t pid,
e = malloc(sizeof(*e));
if (e == NULL)
- return NULL;
+ goto fail_malloc;
- list_head_init(&e->next);
- list_head_init(&e->names);
-
- e->pid = pid;
- e->prog = prog;
- e->daf_name = NULL;
-
- e->re = NULL;
-
- e->state = PROC_INIT;
-
- if (pthread_condattr_init(&cattr)) {
- free(e);
- return NULL;
- }
+ if (pthread_condattr_init(&cattr))
+ goto fail_condattr;
#ifndef __APPLE__
pthread_condattr_setclock(&cattr, PTHREAD_COND_CLOCK);
#endif
- if (pthread_mutex_init(&e->lock, NULL)) {
- free(e);
- return NULL;
- }
+ if (pthread_mutex_init(&e->lock, NULL))
+ goto fail_mutex;
+ if (pthread_cond_init(&e->cond, &cattr))
+ goto fail_cond;
- if (pthread_cond_init(&e->cond, &cattr)) {
- pthread_mutex_destroy(&e->lock);
- free(e);
- return NULL;
- }
+ e->set = shm_flow_set_create(pid);
+ if (e->set == NULL)
+ goto fail_set;
+
+ list_head_init(&e->next);
+ list_head_init(&e->names);
+
+ e->pid = pid;
+ e->prog = prog;
+ e->re = NULL;
+ e->state = PROC_INIT;
return e;
+ fail_set:
+ pthread_cond_destroy(&e->cond);;
+ fail_cond:
+ pthread_mutex_destroy(&e->lock);
+ fail_mutex:
+ pthread_condattr_destroy(&cattr);
+ fail_condattr:
+ free(e);
+ fail_malloc:
+ return NULL;
}
static void cancel_proc_entry(void * o)
@@ -124,6 +127,8 @@ void proc_entry_destroy(struct proc_entry * e)
pthread_mutex_unlock(&e->lock);
+ shm_flow_set_destroy(e->set);
+
pthread_cond_destroy(&e->cond);
pthread_mutex_destroy(&e->lock);