summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/fmgr.c
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-08-25 10:04:11 +0200
committerSander Vrijders <[email protected]>2016-08-25 10:04:11 +0200
commitd240499ba1699be3da5c04504ae2f5c5e44c7e80 (patch)
tree4b85439372c516e55e9e4fc7619dd0db62070ab3 /src/ipcpd/normal/fmgr.c
parent5b74bb43d36624c4cfb81d5b37833ea241061b26 (diff)
downloadouroboros-d240499ba1699be3da5c04504ae2f5c5e44c7e80.tar.gz
ouroboros-d240499ba1699be3da5c04504ae2f5c5e44c7e80.zip
ipcpd: normal: Fix uninitialized value
This removes the ret value which was not being set correctly.
Diffstat (limited to 'src/ipcpd/normal/fmgr.c')
-rw-r--r--src/ipcpd/normal/fmgr.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c
index 23d9514a..2e73d71f 100644
--- a/src/ipcpd/normal/fmgr.c
+++ b/src/ipcpd/normal/fmgr.c
@@ -428,7 +428,6 @@ int fmgr_flow_alloc_resp(pid_t n_api,
{
struct n_flow * flow;
flow_alloc_msg_t msg = FLOW_ALLOC_MSG__INIT;
- int ret;
buffer_t buf;
pthread_mutex_lock(&fmgr->n_flows_lock);
@@ -464,26 +463,30 @@ int fmgr_flow_alloc_resp(pid_t n_api,
flow_alloc_msg__pack(&msg, buf.data);
if (response < 0) {
- ret = frct_i_destroy(flow->frct_i, &buf);
+ frct_i_destroy(flow->frct_i, &buf);
free(buf.data);
list_del(&flow->next);
free(flow);
} else {
- frct_i_accept(flow->frct_i, &buf);
+ if (frct_i_accept(flow->frct_i, &buf)) {
+ pthread_mutex_unlock(&fmgr->n_flows_lock);
+ return -1;
+ }
+
flow->flow.state = FLOW_ALLOCATED;
flow->flow.api = n_api;
flow->flow.rb = shm_ap_rbuff_open(n_api);
if (flow->flow.rb == NULL) {
- ret = n_flow_dealloc(port_id);
+ n_flow_dealloc(port_id);
pthread_mutex_unlock(&fmgr->n_flows_lock);
- return ret;
+ return -1;
}
}
pthread_mutex_unlock(&fmgr->n_flows_lock);
- return ret;
+ return 0;
}
int fmgr_flow_dealloc(int port_id)