From: Yu Watanabe Date: Wed, 20 Nov 2024 16:15:31 +0000 (+0900) Subject: network/nexthop: do not share NextHop.nexthops and NextHop.routes with duplicated... X-Git-Tag: v258-rc1~1883^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b5f2d7a1eccf5305aa2f9f4b9e7a71a14c804334;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c index c639b01c222..eb557e580ee 100644 --- a/src/network/networkd-nexthop.c +++ b/src/network/networkd-nexthop.c @@ -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;