diff options
author | Dimitri Staessens <[email protected]> | 2022-02-25 00:15:28 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2022-03-03 12:00:53 +0100 |
commit | 27374c05645cb6a656e82a9a0b6bc810082cfe4e (patch) | |
tree | 9177d572965d352ca606e5535a5971e91fddde4a /src/ipcpd/local/main.c | |
parent | 9719dbe335af4c6add39d739f78a68040b62d8a3 (diff) | |
download | ouroboros-27374c05645cb6a656e82a9a0b6bc810082cfe4e.tar.gz ouroboros-27374c05645cb6a656e82a9a0b6bc810082cfe4e.zip |
ipcpd: Fix some unchecked return values
Fixes some unchecked and wrongly checked return values.
Signed-off-by: Dimitri Staessens <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/ipcpd/local/main.c')
-rw-r--r-- | src/ipcpd/local/main.c | 28 |
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){ |