mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 13:00:22 +01:00
dhcp: fix memleak parsing dhclient file with multiple dhcp-client-identifier lines
This commit is contained in:
parent
dc3eaaaac6
commit
056f2679b8
2 changed files with 6 additions and 1 deletions
|
|
@ -279,6 +279,7 @@ nm_dhcp_dhclient_create_config (const char *interface,
|
|||
|
||||
g_return_val_if_fail (!anycast_addr || nm_utils_hwaddr_valid (anycast_addr, ETH_ALEN), NULL);
|
||||
g_return_val_if_fail (NM_IN_SET (addr_family, AF_INET, AF_INET6), NULL);
|
||||
nm_assert (!out_new_client_id || !*out_new_client_id);
|
||||
|
||||
new_contents = g_string_new (_("# Created by NetworkManager\n"));
|
||||
fqdn_opts = g_ptr_array_sized_new (5);
|
||||
|
|
@ -332,6 +333,8 @@ nm_dhcp_dhclient_create_config (const char *interface,
|
|||
continue;
|
||||
|
||||
/* Otherwise capture and return the existing client id */
|
||||
if (out_new_client_id)
|
||||
g_clear_pointer (out_new_client_id, g_bytes_unref);
|
||||
NM_SET_OUT (out_new_client_id, read_client_id (p));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -518,8 +518,10 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
|
|||
priv->conf_file = create_dhclient_config (self, AF_INET, iface, uuid, client_id, dhcp_anycast_addr,
|
||||
hostname, timeout, use_fqdn, &new_client_id);
|
||||
if (priv->conf_file) {
|
||||
if (new_client_id)
|
||||
if (new_client_id) {
|
||||
nm_assert (!client_id);
|
||||
nm_dhcp_client_set_client_id (client, new_client_id);
|
||||
}
|
||||
success = dhclient_start (client, NULL, NULL, FALSE, NULL, 0);
|
||||
} else
|
||||
_LOGW ("error creating dhclient configuration file");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue