diff options
| author | Thomas Haller <thaller@redhat.com> | 2018-09-10 14:31:23 +0200 |
|---|---|---|
| committer | Thomas Haller <thaller@redhat.com> | 2018-09-10 14:39:41 +0200 |
| commit | 13aaad7c5bf6fd0a0cf105fb8b042dffdb11d9f3 (patch) | |
| tree | 611c45c359f44b4e244f53b4bb7418ec0dcdba49 | |
| parent | fd6acf61830d6d11ad86b9775136a88b4506756a (diff) | |
| download | NetworkManager-13aaad7c5bf6fd0a0cf105fb8b042dffdb11d9f3.tar.gz | |
dhcp: fix leak in dhclient's dhclient_start()
Fixes: 5d6d5cd136e36ed2815b7c719ada32bc6d22b481
(cherry picked from commit c87faf07a10900804b914057a2673e0e070b0af4)
(cherry picked from commit 8f9240de966e431c2b7623e88a4e37700086d355)
(cherry picked from commit c740726b570c004635c43bc50c5dbbcde10cfd2e)
(cherry picked from commit 0a69572cae6c2154a178de17c82674b14565cfaa)
| -rw-r--r-- | src/dhcp/nm-dhcp-dhclient.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dhcp/nm-dhcp-dhclient.c b/src/dhcp/nm-dhcp-dhclient.c index f20158c64d..4e71f55412 100644 --- a/src/dhcp/nm-dhcp-dhclient.c +++ b/src/dhcp/nm-dhcp-dhclient.c @@ -386,11 +386,15 @@ dhclient_start (NMDhcpClient *client, if (g_file_copy (src, dst, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error)) { /* Success; use the preferred leasefile path */ g_free (priv->lease_file); - priv->lease_file = g_strdup (g_file_get_path (dst)); + priv->lease_file = g_file_get_path (dst); } else { + gs_free char *s_path = NULL; + gs_free char *d_path = NULL; + /* Failure; just use the existing leasefile */ _LOGW ("failed to copy leasefile %s to %s: %s", - g_file_get_path (src), g_file_get_path (dst), + (s_path = g_file_get_path (src)), + (d_path = g_file_get_path (dst)), error->message); g_clear_error (&error); } |
