From b5f2d7a1eccf5305aa2f9f4b9e7a71a14c804334 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 21 Nov 2024 01:15:31 +0900 Subject: [PATCH] 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. --- src/network/networkd-nexthop.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c index c639b01c22..eb557e580e 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;