[systemd-devel] [PATCH] networkd: don't clear dhcpv6 lease timers if there's no previous lease

Steven Noonan steven at uplinklabs.net
Thu Jul 3 19:43:56 PDT 2014


If client->lease is NULL, dhcp6_lease_clear_timers will cause a segmentation
fault.
---
 src/libsystemd-network/sd-dhcp6-client.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index 8fdbbfe..a83778e 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -708,7 +708,8 @@ static int client_receive_reply(sd_dhcp6_client *client, DHCP6Message *reply,
                         return 0;
         }
 
-        dhcp6_lease_clear_timers(&client->lease->ia);
+        if (client->lease)
+            dhcp6_lease_clear_timers(&client->lease->ia);
 
         client->lease = sd_dhcp6_lease_unref(client->lease);
         client->lease = lease;
-- 
2.0.1



More information about the systemd-devel mailing list