summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-03-27 12:47:20 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2017-03-28 10:26:06 +0200
commitad6a813edab5a14866b045d37fe2ce7e1f9a126d (patch)
tree6da7a30ed4d64552ea4f2948fbbf47186ca44448 /src
parent9e3dffb25570fc12dd43f8fad721be40374ea35b (diff)
downloadouroboros-ad6a813edab5a14866b045d37fe2ce7e1f9a126d.tar.gz
ouroboros-ad6a813edab5a14866b045d37fe2ce7e1f9a126d.zip
ipcpd: normal: Fix wrong update to index
The index j in the function that transforms the list of predecessors to a routing table was incremented at the wrong time.
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/normal/graph.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ipcpd/normal/graph.c b/src/ipcpd/normal/graph.c
index dd6b0e7a..5fd6fcb6 100644
--- a/src/ipcpd/normal/graph.c
+++ b/src/ipcpd/normal/graph.c
@@ -475,7 +475,7 @@ ssize_t graph_routing_table(struct graph * graph,
index = get_vertex_index(graph, prev);
}
- (*table)[++j] = malloc(sizeof(***table));
+ (*table)[j] = malloc(sizeof(***table));
if ((*table)[j] == NULL) {
pthread_mutex_unlock(&graph->lock);
for (k = 0; k < j; ++k)
@@ -487,7 +487,7 @@ ssize_t graph_routing_table(struct graph * graph,
(*table)[j]->dst = v->addr;
(*table)[j]->nhop = nhop->addr;
-
+ j++;
i++;
}