summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-03-30 13:29:59 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-03-30 13:29:59 +0200
commit8dfa06b867baac47eabc6af3549c2c6a276670b7 (patch)
treea3e83bde210876d185d5df4457e766c62c346e74 /src/lib
parentdd993fcf19f02dc1c694e16cd6fafadceb19dd4e (diff)
downloadouroboros-8dfa06b867baac47eabc6af3549c2c6a276670b7.tar.gz
ouroboros-8dfa06b867baac47eabc6af3549c2c6a276670b7.zip
lib: bugfixes in flow
forgotten return statement forgotten NULL check
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/flow.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/flow.c b/src/lib/flow.c
index 67b8e71b..ab9ad802 100644
--- a/src/lib/flow.c
+++ b/src/lib/flow.c
@@ -30,6 +30,11 @@
flow_t * flow_create(int32_t port_id)
{
flow_t * flow = malloc(sizeof *flow);
+ if (flow == NULL) {
+ LOG_DBGF("Could not malloc flow.");
+ return NULL;
+ }
+
flow->port_id = port_id;
flow->oflags = FLOW_O_DEFAULT;
flow->state = FLOW_INIT;
@@ -47,7 +52,7 @@ void flow_destroy(flow_t * flow)
int flow_set_opts(flow_t * flow, uint16_t opts)
{
if (flow == NULL) {
- LOG_ERR("Non-existing flow.");
+ LOG_DBGF("Non-existing flow.");
return -1;
}
@@ -57,6 +62,7 @@ int flow_set_opts(flow_t * flow, uint16_t opts)
pthread_mutex_unlock(&flow->lock);
LOG_WARN("Invalid flow options. Setting default.");
opts = FLOW_O_DEFAULT;
+ return -1;
}
flow->oflags = opts;
@@ -69,7 +75,7 @@ int flow_set_opts(flow_t * flow, uint16_t opts)
uint16_t flow_get_opts(const flow_t * flow)
{
if (flow == NULL) {
- LOG_ERR("Non-existing flow.");
+ LOG_DBGF("Non-existing flow.");
return FLOW_O_INVALID;
}