From 0ee5cb87937a42e87a0ca2d95929aa6e14ee05c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20A=2E=20Ortega?= Date: Thu, 13 Jul 2017 21:56:19 +0200 Subject: [PATCH] Fixed a few mistakes. --- src/nodes.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/nodes.c b/src/nodes.c index 7671eba..3795b91 100644 --- a/src/nodes.c +++ b/src/nodes.c @@ -26,12 +26,16 @@ #include int NeoComm_init_nodes(unsigned int max_nodes) { - if(max_nodes != 0) - return 1; + // If we want 0 nodes then don't initialize, give error if + // already initialized + if(max_nodes == 0 || node_max != 0) + return 0; + node_list = calloc(max_nodes, sizeof(struct NeoComm_node)); if(!node_list) return 0; + // Set to NULL to check for free spots for(unsigned int i = 0; i < max_nodes; ++i) node_list[i].address.address = NULL;