teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
Blob Blame History Raw
From 1b74050afb9b407eaa59c67b6015611c9113f7e4 Mon Sep 17 00:00:00 2001
From: Steven Noonan <steven@uplinklabs.net>
Date: Thu, 3 Jul 2014 19:43:56 -0700
Subject: [PATCH] networkd: don't clear dhcpv6 lease timers if there's no
 previous lease

If client->lease is NULL, dhcp6_lease_clear_timers will cause a segmentation
fault.

(cherry picked from commit b1e1238fb3af77419eca704fb64f68a313954734)
---
 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 8fdbbfe320..a83778e938 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;