mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
components/bt: Optimization and bugfix of previous commit
This commit is contained in:
parent
07fef85a23
commit
9863565a6f
@ -96,7 +96,7 @@ typedef struct {
|
|||||||
cache_addr_info_t cache_addr[MAX_DEVICE_IN_CACHE];
|
cache_addr_info_t cache_addr[MAX_DEVICE_IN_CACHE];
|
||||||
}cache_env_t;
|
}cache_env_t;
|
||||||
|
|
||||||
cache_env_t *cache_env = NULL;
|
static cache_env_t *cache_env = NULL;
|
||||||
|
|
||||||
static void getFilename(char *buffer, hash_key_t hash)
|
static void getFilename(char *buffer, hash_key_t hash)
|
||||||
{
|
{
|
||||||
@ -382,10 +382,15 @@ void bta_gattc_co_cache_addr_init(void)
|
|||||||
UINT8 num_addr;
|
UINT8 num_addr;
|
||||||
size_t length = MAX_ADDR_LIST_CACHE_BUF;
|
size_t length = MAX_ADDR_LIST_CACHE_BUF;
|
||||||
UINT8 *p_buf = osi_malloc(MAX_ADDR_LIST_CACHE_BUF);
|
UINT8 *p_buf = osi_malloc(MAX_ADDR_LIST_CACHE_BUF);
|
||||||
|
if (p_buf == NULL) {
|
||||||
|
APPL_TRACE_ERROR("%s malloc failed!", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cache_env = (cache_env_t *)osi_malloc(sizeof(cache_env_t));
|
cache_env = (cache_env_t *)osi_malloc(sizeof(cache_env_t));
|
||||||
if (cache_env == NULL || p_buf == NULL) {
|
if (cache_env == NULL) {
|
||||||
APPL_TRACE_ERROR("%s malloc failed!", __func__);
|
APPL_TRACE_ERROR("%s malloc failed!", __func__);
|
||||||
|
osi_free(p_buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,4 +337,3 @@ void btc_config_unlock(void)
|
|||||||
{
|
{
|
||||||
osi_mutex_unlock(&lock);
|
osi_mutex_unlock(&lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user