fix(bt): fix alloc-size warning

Warning: allocation of insufficient size '36' for type 'tBTA_DM_MSG'
with size '320' [-Werror=alloc-size]
This commit is contained in:
Alexey Lapshin 2024-07-05 23:29:26 +07:00
parent 205e814563
commit f1c0fc0bbd

View File

@ -2385,7 +2385,12 @@ void bta_dm_queue_search (tBTA_DM_MSG *p_data)
osi_free(bta_dm_search_cb.p_search_queue);
}
bta_dm_search_cb.p_search_queue = (tBTA_DM_MSG *)osi_malloc(sizeof(tBTA_DM_API_SEARCH));
tBTA_DM_API_SEARCH *search_queue = osi_malloc(sizeof(tBTA_DM_API_SEARCH));
if (search_queue == NULL) {
APPL_TRACE_ERROR("%s: couldn't allocate memory", __func__);
return;
}
bta_dm_search_cb.p_search_queue = (tBTA_DM_MSG *) search_queue;
memcpy(bta_dm_search_cb.p_search_queue, p_data, sizeof(tBTA_DM_API_SEARCH));
}
@ -2406,7 +2411,12 @@ void bta_dm_queue_disc (tBTA_DM_MSG *p_data)
osi_free(bta_dm_search_cb.p_search_queue);
}
bta_dm_search_cb.p_search_queue = (tBTA_DM_MSG *)osi_malloc(sizeof(tBTA_DM_API_DISCOVER));
tBTA_DM_API_DISCOVER *search_queue = osi_malloc(sizeof(tBTA_DM_API_DISCOVER));
if (search_queue == NULL) {
APPL_TRACE_ERROR("%s: couldn't allocate memory", __func__);
return;
}
bta_dm_search_cb.p_search_queue = (tBTA_DM_MSG *)search_queue;
memcpy(bta_dm_search_cb.p_search_queue, p_data, sizeof(tBTA_DM_API_DISCOVER));
}
#endif ///SDP_INCLUDED == TRUE