summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-05-08 19:28:17 +0200
committerTom Gundersen <teg@jklm.no>2014-05-09 14:41:27 +0200
commit47e2dc3168cb0509d8d61f5dbeffaa3c252685b5 (patch)
treefc9ec9376779c989a7765c0ab00a1d436e959edd
parent69a93e7db47addc4495a6ec9dc0fc74092a6ebee (diff)
networkd: network - do reference counting on netdevs
-rw-r--r--src/network/networkd-network.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 4493359d79..a452096836 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -145,6 +145,7 @@ int network_load(Manager *manager) {
}
void network_free(Network *network) {
+ NetDev *netdev;
Route *route;
Address *address;
Iterator i;
@@ -167,8 +168,16 @@ void network_free(Network *network) {
set_free(network->dns);
+ netdev_unref(network->bridge);
+
+ netdev_unref(network->bond);
+
+ HASHMAP_FOREACH(netdev, network->vlans, i)
+ netdev_unref(netdev);
hashmap_free(network->vlans);
+ HASHMAP_FOREACH(netdev, network->macvlans, i)
+ netdev_unref(netdev);
hashmap_free(network->macvlans);
while ((route = network->static_routes))
@@ -317,5 +326,7 @@ int config_parse_netdev(const char *unit,
assert_not_reached("Can not parse NetDev");
}
+ netdev_ref(netdev);
+
return 0;
}