]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/libsystemd-network/sd-dhcp6-lease.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / libsystemd-network / sd-dhcp6-lease.c
index f34af6eabaa56f68dd7fcea59bdb21791249697a..6f604e072f93c61d641777c64b6cf61f6746a8b7 100644 (file)
@@ -1,5 +1,4 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd.
 
 
 #include <errno.h>
 
-#include "strv.h"
-#include "util.h"
-
+#include "alloc-util.h"
 #include "dhcp6-lease-internal.h"
 #include "dhcp6-protocol.h"
+#include "strv.h"
+#include "util.h"
 
 int dhcp6_lease_clear_timers(DHCP6IA *ia) {
         assert_return(ia, -EINVAL);
@@ -228,7 +227,7 @@ int dhcp6_lease_set_domains(sd_dhcp6_lease *lease, uint8_t *optval,
         if (r < 0)
                 return 0;
 
-        free(lease->domains);
+        strv_free(lease->domains);
         lease->domains = domains;
         lease->domains_count = r;
 
@@ -256,7 +255,7 @@ int dhcp6_lease_set_ntp(sd_dhcp6_lease *lease, uint8_t *optval, size_t optlen) {
         assert_return(lease, -EINVAL);
         assert_return(optval, -EINVAL);
 
-        free(lease->ntp);
+        lease->ntp = mfree(lease->ntp);
         lease->ntp_count = 0;
         lease->ntp_allocated = 0;
 
@@ -391,9 +390,7 @@ sd_dhcp6_lease *sd_dhcp6_lease_unref(sd_dhcp6_lease *lease) {
         free(lease->ntp);
 
         lease->ntp_fqdn = strv_free(lease->ntp_fqdn);
-        free(lease);
-
-        return NULL;
+        return mfree(lease);
 }
 
 int dhcp6_lease_new(sd_dhcp6_lease **ret) {