mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
components/bt: Add NULL value check in bta_gattc_get_service_with_uuid()
Signed-off-by: Hrishikesh Dhayagude <hrishi@espressif.com>
This commit is contained in:
@@ -1142,6 +1142,11 @@ void bta_gattc_get_service_with_uuid(UINT16 conn_id, tBT_UUID *svc_uuid,
|
|||||||
int *count)
|
int *count)
|
||||||
{
|
{
|
||||||
const list_t* svc = bta_gattc_get_services(conn_id);
|
const list_t* svc = bta_gattc_get_services(conn_id);
|
||||||
|
if (svc == NULL) {
|
||||||
|
*svc_db = NULL;
|
||||||
|
*count = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
size_t db_size = list_length(svc);
|
size_t db_size = list_length(svc);
|
||||||
void *buffer = osi_malloc(db_size*sizeof(btgatt_db_element_t));
|
void *buffer = osi_malloc(db_size*sizeof(btgatt_db_element_t));
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
|
Reference in New Issue
Block a user