summaryrefslogtreecommitdiff
path: root/src/ipcpd/local
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipcpd/local')
-rw-r--r--src/ipcpd/local/main.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index 9c62c3cc..c0e0b702 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -72,24 +72,28 @@ static int local_data_init(void)
local_data.flows = fset_create();
if (local_data.flows == NULL)
- return -ENFILE;
+ goto fail_fset;
local_data.fq = fqueue_create();
- if (local_data.fq == NULL) {
- fset_destroy(local_data.flows);
- return -ENOMEM;
- }
+ if (local_data.fq == NULL)
+ goto fail_fqueue;
local_data.shim_data = shim_data_create();
- if (local_data.shim_data == NULL) {
- fqueue_destroy(local_data.fq);
- fset_destroy(local_data.flows);
- return -ENOMEM;
- }
-
- pthread_rwlock_init(&local_data.lock, NULL);
+ if (local_data.shim_data == NULL)
+ goto fail_shim_data;
+ if (pthread_rwlock_init(&local_data.lock, NULL) < 0)
+ goto fail_rwlock_init;
return 0;
+
+ fail_rwlock_init:
+ shim_data_destroy(local_data.shim_data);
+ fail_shim_data:
+ fqueue_destroy(local_data.fq);
+ fail_fqueue:
+ fset_destroy(local_data.flows);
+ fail_fset:
+ return -ENOMEM;
}
static void local_data_fini(void){