Skip to content

Commit

Permalink
route: fix route tables copy used in lease clone
Browse files Browse the repository at this point in the history
  • Loading branch information
mtomaschewski committed Oct 12, 2022
1 parent e89ead1 commit f6464ab
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/route.c
Expand Up @@ -1720,21 +1720,20 @@ ni_route_tables_copy(ni_route_table_t **dst, const ni_route_table_t *src)
{
const ni_route_table_t *srt;
const ni_route_t *srp;
ni_route_table_t *rt;
ni_route_t *rp;
unsigned int i;

if (!dst)
return;

for (srt = src; srt; srt = srt->next) {
if (!(rt = ni_route_table_new(srt->tid)))
continue;

for (i = 0; i < srt->routes.count; ++i) {
if (!(srp = srt->routes.data[i]))
continue;

ni_route_array_append(&rt->routes, ni_route_clone(srp));
rp = ni_route_clone(srp);
if (!ni_route_tables_add_route(dst, rp))
ni_route_free(rp);
}
}
}
Expand Down

0 comments on commit f6464ab

Please sign in to comment.