diff --git a/android/a2dp.c b/android/a2dp.c
index 731fa16..8cff535 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
setup_remove_all_by_dev(dev);
- devices = g_slist_remove(devices, dev);
g_free(dev);
}
+static void a2dp_device_remove(struct a2dp_device *dev)
+{
+ devices = g_slist_remove(devices, dev);
+ a2dp_device_free(dev);
+}
+
static struct a2dp_device *a2dp_device_new(const bdaddr_t *dst)
{
struct a2dp_device *dev;
bt_avrcp_disconnect(&dev->dst);
- a2dp_device_free(dev);
+ a2dp_device_remove(dev);
}
static void bt_audio_notify_state(struct a2dp_setup *setup, uint8_t state)
dev = a2dp_device_new(&dst);
if (!a2dp_device_connect(dev, signaling_connect_cb)) {
- a2dp_device_free(dev);
+ a2dp_device_remove(dev);
status = HAL_STATUS_FAILED;
goto failed;
}