networkd-dhcp6: Set initial value of route to NULL
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Wed, 26 Sep 2018 00:09:17 +0000 (18:09 -0600)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 26 Sep 2018 13:15:37 +0000 (15:15 +0200)
Start with route set to NULL should there be no route created. Remove
the explicit route_free as the _cleanup_ will take care of that after
the continue;.

src/network/networkd-dhcp6.c

index 518d3e8..df6bbcb 100644 (file)
@@ -134,7 +134,7 @@ int dhcp6_lease_pd_prefix_lost(sd_dhcp6_client *client, Link* link) {
                                      &lifetime_preferred,
                                      &lifetime_valid) >= 0) {
                 _cleanup_free_ char *buf = NULL;
-                _cleanup_free_ Route *route;
+                _cleanup_free_ Route *route = NULL;
 
                 if (pd_prefix_len > 64)
                         continue;
@@ -163,7 +163,7 @@ int dhcp6_lease_pd_prefix_lost(sd_dhcp6_client *client, Link* link) {
                                 log_link_warning_errno(link, r, "Cannot delete unreachable route for DHCPv6 delegated subnet %s/%u: %m",
                                                        strnull(buf),
                                                        pd_prefix_len);
-                                route_free(route);
+
                                 continue;
                         }
                         link = link_ref(link);