summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/graph.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-03-24 10:41:55 +0000
committerdimitri staessens <dimitri.staessens@ugent.be>2017-03-24 10:41:55 +0000
commitd51b66d838f7d3235f869e3dc1b8e8f9fe8e1147 (patch)
tree8449518cff92a5678f3e36e3d1c6b6ced3f54a1d /src/ipcpd/normal/graph.c
parent7c5727c35c961c0b579a754ecdf0870b8db383b1 (diff)
parent6a119fb353ec862151543489201b20f67628a6f2 (diff)
downloadouroboros-d51b66d838f7d3235f869e3dc1b8e8f9fe8e1147.tar.gz
ouroboros-d51b66d838f7d3235f869e3dc1b8e8f9fe8e1147.zip
Merged in sandervrijders/ouroboros/be-neg-malloc (pull request #419)
ipcpd: normal: Fix negative malloc
Diffstat (limited to 'src/ipcpd/normal/graph.c')
-rw-r--r--src/ipcpd/normal/graph.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ipcpd/normal/graph.c b/src/ipcpd/normal/graph.c
index ecaff14c..b3e105e3 100644
--- a/src/ipcpd/normal/graph.c
+++ b/src/ipcpd/normal/graph.c
@@ -235,6 +235,8 @@ int graph_add_edge(struct graph * graph,
pthread_mutex_unlock(&graph->lock);
+ log_dbg("Added an edge to the graph.");
+
return 0;
}
@@ -268,6 +270,8 @@ int graph_update_edge(struct graph * graph,
pthread_mutex_unlock(&graph->lock);
+ log_dbg("Updated an edge of the graph.");
+
return 0;
}
@@ -315,6 +319,8 @@ int graph_del_edge(struct graph * graph,
pthread_mutex_unlock(&graph->lock);
+ log_dbg("Removed an edge of the graph.");
+
return 0;
}
@@ -453,6 +459,11 @@ ssize_t graph_routing_table(struct graph * graph,
pthread_mutex_lock(&graph->lock);
+ if (graph->nr_vertices == 0) {
+ pthread_mutex_unlock(&graph->lock);
+ return 0;
+ }
+
prevs = dijkstra(graph, s_addr);
if (prevs == NULL) {
pthread_mutex_unlock(&graph->lock);