]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/nexthop: do not share NextHop.nexthops and NextHop.routes with duplicated...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 20 Nov 2024 16:15:31 +0000 (01:15 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 11 Dec 2024 02:21:14 +0000 (11:21 +0900)
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

index c639b01c222c678e9384855380c2ad24dd08b3a0..eb557e580ee17a2aad6f68f0b5ea49be279c50c1 100644 (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;