summaryrefslogtreecommitdiff
path: root/src/modules/bluetooth/bluetooth-util.c
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2012-12-18 08:47:58 +0200
committerTanu Kaskinen <tanuk@iki.fi>2012-12-19 12:31:50 +0200
commitaf0c45386faa8828c5b682211673265d677f376d (patch)
treee275f27ca5b95637ef42f36716a60a6134c76301 /src/modules/bluetooth/bluetooth-util.c
parent6f1c3df37b85b47cd1d2d3b046d79ad13d8e61ac (diff)
downloadpulseaudio-af0c45386faa8828c5b682211673265d677f376d.tar.gz
bluetooth: Don't access a transport after it's freed.
In addition to moving the freeing a bit later, unnecessary checks for t->device are removed. t->device is initialized to a non-NULL value when the transport is created, and it's never changed.
Diffstat (limited to 'src/modules/bluetooth/bluetooth-util.c')
-rw-r--r--src/modules/bluetooth/bluetooth-util.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 392f4a5a4..61c52f565 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1388,17 +1388,18 @@ static DBusMessage *endpoint_clear_configuration(DBusConnection *c, DBusMessage
}
if ((t = pa_hashmap_get(y->transports, path))) {
- bool old_any_connected = t->device ? pa_bluetooth_device_any_audio_connected(t->device) : false;
+ bool old_any_connected = pa_bluetooth_device_any_audio_connected(t->device);
pa_log_debug("Clearing transport %s profile %d", t->path, t->profile);
t->device->transports[t->profile] = NULL;
pa_hashmap_remove(y->transports, t->path);
t->state = PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED;
pa_hook_fire(&y->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED], t);
- transport_free(t);
- if (t->device && old_any_connected != pa_bluetooth_device_any_audio_connected(t->device))
+ if (old_any_connected != pa_bluetooth_device_any_audio_connected(t->device))
run_callback(t->device, FALSE);
+
+ transport_free(t);
}
pa_assert_se(r = dbus_message_new_method_return(m));