diff --git a/android/handsfree-client.c b/android/handsfree-client.c
index b63aa13..aa3912b 100644
--- a/android/handsfree-client.c
+++ b/android/handsfree-client.c
#include "lib/sdp.h"
#include "lib/sdp_lib.h"
#include "src/sdp-client.h"
+#include "src/shared/queue.h"
#include "ipc.h"
#include "ipc-common.h"
#include "src/log.h"
static uint32_t hfp_hf_features = 0;
static uint32_t hfp_hf_record_id = 0;
+static struct queue *devices = NULL;
static void handle_connect(const void *buf, uint16_t len)
{
{
DBG("");
+ devices = queue_new();
+ if (!devices) {
+ error("hf-client: Could not create devices list");
+ goto failed;
+ }
+
bacpy(&adapter_addr, addr);
if (!enable_hf_client())
- return false;
+ goto failed;
hal_ipc = ipc;
ipc_register(hal_ipc, HAL_SERVICE_ID_HANDSFREE_CLIENT, cmd_handlers,
G_N_ELEMENTS(cmd_handlers));
return true;
+
+failed:
+ queue_destroy(devices, free);
+ devices = NULL;
+
+ return false;
}
void bt_hf_client_unregister(void)
cleanup_hfp_hf();
+ queue_destroy(devices, free);
+ devices = NULL;
+
ipc_unregister(hal_ipc, HAL_SERVICE_ID_HANDSFREE);
hal_ipc = NULL;
}