summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-address-label.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-11-12 07:24:11 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-11-12 08:32:11 +0100
commit3e5700428e768438bb1083e004be23201ede4e08 (patch)
treeca5bae7b03fe762e2c78c82b45140651c2a1c1b6 /src/network/networkd-address-label.c
parentnetwork: do not assign unused value (diff)
downloadsystemd-3e5700428e768438bb1083e004be23201ede4e08.tar.xz
systemd-3e5700428e768438bb1083e004be23201ede4e08.zip
network: allocate hashmap objects when they are required
Diffstat (limited to 'src/network/networkd-address-label.c')
-rw-r--r--src/network/networkd-address-label.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/network/networkd-address-label.c b/src/network/networkd-address-label.c
index 1392cba538..691bbf4761 100644
--- a/src/network/networkd-address-label.c
+++ b/src/network/networkd-address-label.c
@@ -65,6 +65,10 @@ static int address_label_new_static(Network *network, const char *filename, unsi
if (filename) {
label->section = TAKE_PTR(n);
+ r = hashmap_ensure_allocated(&network->address_labels_by_section, &network_config_hash_ops);
+ if (r < 0)
+ return r;
+
r = hashmap_put(network->address_labels_by_section, label->section, label);
if (r < 0)
return r;