]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: Address- initialize the node before adding to list. 3113/head
authorSusant Sahani <ssahani@redhat.com>
Mon, 25 Apr 2016 07:08:56 +0000 (12:38 +0530)
committerSusant Sahani <ssahani@redhat.com>
Mon, 25 Apr 2016 07:08:56 +0000 (12:38 +0530)
It make more sense to initalize the node first then
we add to the list.

src/network/networkd-address.c

index 7f9a7268cc1c53ceea5c0238f2d6e296bb1ae0ce..429319da6bbbd3e50bde4965303eb7415fee272d 100644 (file)
@@ -67,16 +67,15 @@ int address_new_static(Network *network, unsigned section, Address **ret) {
         if (r < 0)
                 return r;
 
-        address->network = network;
-
-        LIST_APPEND(addresses, network->static_addresses, address);
-
         if (section) {
                 address->section = section;
                 hashmap_put(network->addresses_by_section,
                             UINT_TO_PTR(address->section), address);
         }
 
+        address->network = network;
+        LIST_APPEND(addresses, network->static_addresses, address);
+
         *ret = address;
         address = NULL;