Merge branch 'bugfix/fix_probable_mem_leak' into 'master'

components/bt: Fix a probable memory leak for BTA_GATTS_CONF_EVT event

See merge request idf/esp-idf!2962
This commit is contained in:
Jiang Jiang Jian 2018-08-27 14:10:22 +08:00
commit 6519f1833a
3 changed files with 5 additions and 7 deletions

View file

@ -702,6 +702,10 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
APPL_TRACE_ERROR("%s, malloc failed", __func__); APPL_TRACE_ERROR("%s, malloc failed", __func__);
} }
(*p_rcb->p_cback)(BTA_GATTS_CONF_EVT, &cb_data); (*p_rcb->p_cback)(BTA_GATTS_CONF_EVT, &cb_data);
if (cb_data.req_data.value != NULL) {
osi_free(cb_data.req_data.value);
cb_data.req_data.value = NULL;
}
} }
} else { } else {
APPL_TRACE_ERROR("Not an registered servce attribute ID: 0x%04x", APPL_TRACE_ERROR("Not an registered servce attribute ID: 0x%04x",

View file

@ -209,10 +209,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
blufi_env.frag_size = p_data->req_data.p_data->mtu - BLUFI_MTU_RESERVED_SIZE; blufi_env.frag_size = p_data->req_data.p_data->mtu - BLUFI_MTU_RESERVED_SIZE;
break; break;
case BTA_GATTS_CONF_EVT: case BTA_GATTS_CONF_EVT:
BLUFI_TRACE_DEBUG("CONIRM EVT\n"); BLUFI_TRACE_DEBUG("CONFIRM EVT\n");
if (p_data && p_data->req_data.value){
osi_free(p_data->req_data.value);
}
/* Nothing */ /* Nothing */
break; break;
case BTA_GATTS_CREATE_EVT: case BTA_GATTS_CREATE_EVT:

View file

@ -530,9 +530,6 @@ static void btc_gatts_cb_param_copy_free(btc_msg_t *msg, tBTA_GATTS *p_data)
} }
break; break;
case BTA_GATTS_CONF_EVT: case BTA_GATTS_CONF_EVT:
if (p_data && p_data->req_data.value){
osi_free(p_data->req_data.value);
}
break; break;
default: default:
break; break;