diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-08-25 10:04:11 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-08-25 10:04:11 +0200 |
commit | d240499ba1699be3da5c04504ae2f5c5e44c7e80 (patch) | |
tree | 4b85439372c516e55e9e4fc7619dd0db62070ab3 /src/ipcpd | |
parent | 5b74bb43d36624c4cfb81d5b37833ea241061b26 (diff) | |
download | ouroboros-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')
-rw-r--r-- | src/ipcpd/normal/fmgr.c | 15 |
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) |