summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2020-02-07 10:56:44 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2020-02-11 09:26:07 +0100
commit43016d6ebd232bb8285f3adb386041100679f362 (patch)
treef6e6d832ec02e0f74c9ac2d300574ec6a42aa28f
parenta119dac99815f4736cb9b3b11a7732bc4c8b32b0 (diff)
n-dhcp4: avoid double free of NDhcp4Outgoing
n_dhcp4_c_connection_start_request() should take ownership of the request only on success. On failure the request is freed by the caller. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/355
-rw-r--r--shared/n-dhcp4/src/n-dhcp4-c-connection.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/shared/n-dhcp4/src/n-dhcp4-c-connection.c b/shared/n-dhcp4/src/n-dhcp4-c-connection.c
index 3dd053567..d4354467d 100644
--- a/shared/n-dhcp4/src/n-dhcp4-c-connection.c
+++ b/shared/n-dhcp4/src/n-dhcp4-c-connection.c
@@ -1104,13 +1104,14 @@ int n_dhcp4_c_connection_start_request(NDhcp4CConnection *connection,
if (request->userdata.start_time == 0)
request->userdata.start_time = timestamp;
- n_dhcp4_outgoing_free(connection->request);
- connection->request = request;
+ connection->request = n_dhcp4_outgoing_free(connection->request);
r = n_dhcp4_c_connection_send_request(connection, request, timestamp);
if (r)
return r;
+ connection->request = request;
+
return 0;
}