dhcp: clean source on dispatch failure (fix leak)

The GSource must also be unrefed. Also, first clear the field
before invoking callbacks to the upper layers.

Fixes: 843d696e46 ('dhcp: clean source on dispatch failure')
This commit is contained in:
Thomas Haller 2020-03-03 09:50:43 +01:00
parent 843d696e46
commit 0549351111

View file

@ -1072,8 +1072,8 @@ dhcp4_event_cb (int fd,
* a predefined number of times (possibly infinite).
*/
_LOGE ("error %d dispatching events", r);
nm_clear_g_source_inst (&priv->event_source);
nm_dhcp_client_set_state (NM_DHCP_CLIENT (self), NM_DHCP_STATE_FAIL, NULL, NULL);
priv->event_source = NULL;
return G_SOURCE_REMOVE;
}