From ad6a813edab5a14866b045d37fe2ce7e1f9a126d Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Mon, 27 Mar 2017 12:47:20 +0200 Subject: 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. --- src/ipcpd/normal/graph.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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++; } -- cgit v1.2.3