summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-25 10:12:02 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-25 10:12:02 +0200
commit8f9aa6f02772d6f46b55741cdd76607a4e22c6a1 (patch)
tree4b85439372c516e55e9e4fc7619dd0db62070ab3
parent5b74bb43d36624c4cfb81d5b37833ea241061b26 (diff)
parentd240499ba1699be3da5c04504ae2f5c5e44c7e80 (diff)
downloadouroboros-8f9aa6f02772d6f46b55741cdd76607a4e22c6a1.tar.gz
ouroboros-8f9aa6f02772d6f46b55741cdd76607a4e22c6a1.zip
Merged in sandervrijders/ouroboros/be-fix (pull request #223)
ipcpd: normal: Fix uninitialized value
-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)