From a1e1dd29787d75c3603190687dbb71a90a0eda4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Wed, 2 Apr 2025 10:31:30 +0200 Subject: [PATCH] n-dhcp4: fix resource leaks The function n_dhcp4_c_connection_send_request does not release or take ownership of its request argument. Because of that, setting it to NULL in the caller prevents the auto-cleanup of the variable to be executed, causing a resource leak. Fix it. Fixes: e23b3c9c3ac8 ('Squashed 'shared/n-dhcp4/' content from commit fb1d43449') Fixes: 243cc433fb77 ('n-dhcp4: add new client probe function to send RELEASE message') (cherry picked from commit 9edfc0438cb6391b01999022567e6ed5aa6bb8db) --- src/n-dhcp4/src/n-dhcp4-c-probe.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/n-dhcp4/src/n-dhcp4-c-probe.c b/src/n-dhcp4/src/n-dhcp4-c-probe.c index 7a6def340c..58d61e72ba 100644 --- a/src/n-dhcp4/src/n-dhcp4-c-probe.c +++ b/src/n-dhcp4/src/n-dhcp4-c-probe.c @@ -1140,8 +1140,6 @@ int n_dhcp4_client_probe_transition_decline(NDhcp4ClientProbe *probe, NDhcp4Inco r = n_dhcp4_c_connection_send_request(&probe->connection, request, ns_now); if (r) return r; - else - request = NULL; /* consumed */ n_dhcp4_client_lease_unlink(probe->current_lease); probe->current_lease = n_dhcp4_client_lease_unref(probe->current_lease); @@ -1346,7 +1344,6 @@ int n_dhcp4_client_probe_release(NDhcp4ClientProbe *probe) { probe->state = N_DHCP4_CLIENT_PROBE_STATE_INIT; n_dhcp4_client_lease_unlink(probe->current_lease); - request_out = NULL; return 0; }