chiark / gitweb /
networkd: link - drop assert from _free()
authorTom Gundersen <teg@jklm.no>
Tue, 1 Jul 2014 08:28:36 +0000 (10:28 +0200)
committerTom Gundersen <teg@jklm.no>
Tue, 1 Jul 2014 08:30:37 +0000 (10:30 +0200)
_free() should always succeed, even if object is not fully allocated.

src/network/networkd-link.c

index c99cafc..8674eee 100644 (file)
@@ -106,8 +106,6 @@ static void link_free(Link *link) {
         if (!link)
                 return;
 
         if (!link)
                 return;
 
-        assert(link->manager);
-
         while ((address = link->addresses)) {
                 LIST_REMOVE(addresses, link->addresses, address);
                 address_free(address);
         while ((address = link->addresses)) {
                 LIST_REMOVE(addresses, link->addresses, address);
                 address_free(address);
@@ -128,7 +126,8 @@ static void link_free(Link *link) {
         sd_dhcp6_client_unref(link->dhcp6_client);
         sd_icmp6_nd_unref(link->icmp6_router_discovery);
 
         sd_dhcp6_client_unref(link->dhcp6_client);
         sd_icmp6_nd_unref(link->icmp6_router_discovery);
 
-        hashmap_remove(link->manager->links, &link->ifindex);
+        if (link->manager)
+                hashmap_remove(link->manager->links, &link->ifindex);
 
         free(link->ifname);
 
 
         free(link->ifname);