am dfd036d9: Merge "fix a memory leakage when Queue search or discovery event." into klp-dev
* commit 'dfd036d96a745af198a532748a600d0c4d6ab1f4':
fix a memory leakage when Queue search or discovery event.
diff --git a/bta/dm/bta_dm_act.c b/bta/dm/bta_dm_act.c
index 40cfb9e..04bd186 100755
--- a/bta/dm/bta_dm_act.c
+++ b/bta/dm/bta_dm_act.c
@@ -2037,6 +2037,10 @@
*******************************************************************************/
void bta_dm_queue_search (tBTA_DM_MSG *p_data)
{
+ if(bta_dm_search_cb.p_search_queue)
+ {
+ GKI_freebuf(bta_dm_search_cb.p_search_queue);
+ }
bta_dm_search_cb.p_search_queue = (tBTA_DM_MSG *)GKI_getbuf(sizeof(tBTA_DM_API_SEARCH));
memcpy(bta_dm_search_cb.p_search_queue, p_data, sizeof(tBTA_DM_API_SEARCH));
@@ -2054,6 +2058,10 @@
*******************************************************************************/
void bta_dm_queue_disc (tBTA_DM_MSG *p_data)
{
+ if(bta_dm_search_cb.p_search_queue)
+ {
+ GKI_freebuf(bta_dm_search_cb.p_search_queue);
+ }
bta_dm_search_cb.p_search_queue = (tBTA_DM_MSG *)GKI_getbuf(sizeof(tBTA_DM_API_DISCOVER));
memcpy(bta_dm_search_cb.p_search_queue, p_data, sizeof(tBTA_DM_API_DISCOVER));