]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: fix memleak around Network.dhcp_vendor_class_identifier
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 27 Sep 2018 08:48:11 +0000 (17:48 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 27 Sep 2018 08:48:34 +0000 (17:48 +0900)
src/network/networkd-network.c

index 107762d5195a6b8496aaf047013fb3ab447a3ea4..8d7795d72c2f19e2cb4f3943bdaf97e2052342d7 100644 (file)
@@ -80,8 +80,7 @@ void network_apply_anonymize_if_set(Network *network) {
         network->dhcp_client_identifier = DHCP_CLIENT_ID_MAC;
         /* RFC 7844 3.10:
          SHOULD NOT use the Vendor Class Identifier option */
-        /* NOTE: it was not initiallized to any value in network_load_one. */
-        network->dhcp_vendor_class_identifier = false;
+        network->dhcp_vendor_class_identifier = mfree(network->dhcp_vendor_class_identifier);
         /* RFC7844 section 3.6.:
          The client intending to protect its privacy SHOULD only request a
          minimal number of options in the PRL and SHOULD also randomly shuffle
@@ -201,10 +200,6 @@ static int network_load_one(Manager *manager, const char *filename) {
         network->dhcp_client_identifier = DHCP_CLIENT_ID_DUID;
         network->dhcp_route_table = RT_TABLE_MAIN;
         network->dhcp_route_table_set = false;
-        /* NOTE: the following vars were not set to any default,
-         * even if they are commented in the man?
-         * These vars might be overwriten by network_apply_anonymize_if_set */
-        network->dhcp_vendor_class_identifier = false;
         /* NOTE: from man: UseMTU=... Defaults to false*/
         network->dhcp_use_mtu = false;
         /* NOTE: from man: UseTimezone=... Defaults to "no".*/