network/nexthop: do not share NextHop.nexthops and NextHop.routes with duplicated object

Otherwise, these may be freed twice.
But, fortunately, when this function is called, both are NULL.
So, this should not change any behavior. But for safety.
This commit is contained in:
Yu Watanabe
2024-12-11 11:21:14 +09:00
parent 00b363bb81
commit b5f2d7a1ec
+2
View File
@@ -261,6 +261,8 @@ static int nexthop_dup(const NextHop *src, NextHop **ret) {
dest->network = NULL;
dest->section = NULL;
dest->group = NULL;
dest->nexthops = NULL;
dest->routes = NULL;
HASHMAP_FOREACH(nhg, src->group) {
_cleanup_free_ struct nexthop_grp *g = NULL;