Skip to content

Commit c55523f

Browse files
committed
netloc: check if node in link exists
Signed-off-by: Cyril Bordage <[email protected]>
1 parent 879fcc4 commit c55523f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

netloc/topology.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,17 @@ netloc_topology_t *netloc_topology_construct(char *path)
175175
char *remain_line = line;
176176

177177
field = line_get_next_field(&remain_line);
178+
if (strlen(field) > 19)
179+
field[19] = '\0';
178180
HASH_FIND_STR(topology->nodes, field, node);
179181

182+
if (!node) {
183+
fprintf(stderr, "Node node found: %s\n", field);
184+
utarray_free(topology->partitions);
185+
utarray_free(topology->topos);
186+
return NULL;
187+
}
188+
180189
while ((field = line_get_next_field(&remain_line))) {
181190
/* There is an edge */
182191
netloc_edge_t *edge = netloc_edge_construct();

0 commit comments

Comments
 (0)