]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-dhcp6-client: make dhcp6_lease_free() accepts NULL
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 24 Sep 2021 14:45:13 +0000 (23:45 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 29 Sep 2021 06:29:40 +0000 (15:29 +0900)
src/libsystemd-network/sd-dhcp6-lease.c

index b69f59c84dae3934cfca8b1dab81cb9484501120..aaafed661bcbc31d8a9470c84c80cb1cb1639ece 100644 (file)
@@ -358,20 +358,18 @@ int sd_dhcp6_lease_get_fqdn(sd_dhcp6_lease *lease, const char **ret) {
 }
 
 static sd_dhcp6_lease *dhcp6_lease_free(sd_dhcp6_lease *lease) {
-        assert(lease);
+        if (!lease)
+                return NULL;
 
         free(lease->serverid);
         dhcp6_lease_free_ia(&lease->ia);
         dhcp6_lease_free_ia(&lease->pd);
-
         free(lease->dns);
         free(lease->fqdn);
-
-        lease->domains = strv_free(lease->domains);
-
+        strv_free(lease->domains);
         free(lease->ntp);
+        strv_free(lease->ntp_fqdn);
 
-        lease->ntp_fqdn = strv_free(lease->ntp_fqdn);
         return mfree(lease);
 }