From a75dfc73e2eec7a1106d835090d9902097e86ea7 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 28 Aug 2020 14:28:07 +0200 Subject: [PATCH] dhcp: workaround "maybe-uninitialized" in dhcp_event_cb() With LTO we get a compiler warning: src/dhcp/nm-dhcp-systemd.c: In function dhcp_event_cb: src/dhcp/nm-dhcp-systemd.c:554: error: lease may be used uninitialized in this function [-Werror=maybe-uninitialized] 554 | r = sd_dhcp_lease_get_server_identifier (lease, &addr); | src/dhcp/nm-dhcp-systemd.c:528: note: lease was declared here 528 | sd_dhcp_lease *lease; | Fixes: 7f217d0345f5 ('core: honor the ipv4.dhcp-reject-servers property') --- src/dhcp/nm-dhcp-systemd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dhcp/nm-dhcp-systemd.c b/src/dhcp/nm-dhcp-systemd.c index b657a42118..cd2a00c713 100644 --- a/src/dhcp/nm-dhcp-systemd.c +++ b/src/dhcp/nm-dhcp-systemd.c @@ -525,7 +525,7 @@ dhcp_event_cb (sd_dhcp_client *client, int event, gpointer user_data) NMDhcpSystemd *self = NM_DHCP_SYSTEMD (user_data); NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (self); char addr_str[INET_ADDRSTRLEN]; - sd_dhcp_lease *lease; + sd_dhcp_lease *lease = NULL; struct in_addr addr; int r;