From: zhiweijian Date: Mon, 31 Jul 2017 09:24:07 +0000 (+0800) Subject: Component/bt: fix esp_ble_gatts_set_attr_value( ) memory leak X-Git-Tag: v3.1-dev~428^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=87d58b9ddb5efe5467f526d2f522a65c1af28d4d;p=esp-idf Component/bt: fix esp_ble_gatts_set_attr_value( ) memory leak --- diff --git a/components/bt/bluedroid/bta/gatt/bta_gatts_act.c b/components/bt/bluedroid/bta/gatt/bta_gatts_act.c index 733976c0ca..f2c601253e 100644 --- a/components/bt/bluedroid/bta/gatt/bta_gatts_act.c +++ b/components/bt/bluedroid/bta/gatt/bta_gatts_act.c @@ -506,7 +506,7 @@ void bta_gatts_set_attr_value(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_ UINT16 service_id = p_srvc_cb->service_id; tBTA_GATTS cb_data; tBTA_GATT_STATUS gatts_status; - gatts_status = GATTS_SetAttributeValue(p_msg->api_add_char_descr.hdr.layer_specific, + gatts_status = GATTS_SetAttributeValue(p_msg->api_set_val.hdr.layer_specific, p_msg->api_set_val.length, p_msg->api_set_val.value); @@ -515,6 +515,10 @@ void bta_gatts_set_attr_value(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_ cb_data.attr_val.attr_id = p_msg->api_set_val.hdr.layer_specific; cb_data.attr_val.status = gatts_status; + if (p_msg->api_set_val.value != NULL){ + GKI_freebuf(p_msg->api_set_val.value); + } + if (p_rcb->p_cback) { (*p_rcb->p_cback)(BTA_GATTS_SET_ATTR_VAL_EVT, &cb_data); }