From 4b2c6de45ccd9cb4bc12ea4ac135a5cb81c45dbe Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Tue, 10 Sep 2024 11:47:50 -0700 Subject: [PATCH] station: fix crash if affinities watch gets removed If the affinity watch is removed by setting an empty list the disconnect callback won't be called which was the only place the watch ID was cleared. This resulted in the next SetProperty call to think a watch existed, and attempt to compare the sender address which would be NULL. The watch ID should be cleared inside the destroy callback, not the disconnect callback. --- src/station.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/station.c b/src/station.c index ec0f7d49..550ef745 100644 --- a/src/station.c +++ b/src/station.c @@ -4601,7 +4601,6 @@ static void station_affinity_disconnected_cb(struct l_dbus *dbus, struct station *station = user_data; l_dbus_remove_watch(dbus_get_bus(), station->affinity_watch); - station->affinity_watch = 0; l_debug("client that set affinity has disconnected"); @@ -4614,6 +4613,8 @@ static void station_affinity_watch_destroy(void *user_data) struct station *station = user_data; bool empty = l_queue_length(station->affinities) == 0; + station->affinity_watch = 0; + l_free(station->affinity_client); station->affinity_client = NULL;