forked from espressif/esp-idf
fix phy init memory leak
This commit is contained in:
@@ -514,6 +514,7 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
|
|||||||
PHY_INIT_MAGIC, sizeof(phy_init_magic_post)) != 0) {
|
PHY_INIT_MAGIC, sizeof(phy_init_magic_post)) != 0) {
|
||||||
#ifndef CONFIG_ESP32_PHY_DEFAULT_INIT_IF_INVALID
|
#ifndef CONFIG_ESP32_PHY_DEFAULT_INIT_IF_INVALID
|
||||||
ESP_LOGE(TAG, "failed to validate PHY data partition");
|
ESP_LOGE(TAG, "failed to validate PHY data partition");
|
||||||
|
free(init_data_store);
|
||||||
return NULL;
|
return NULL;
|
||||||
#else
|
#else
|
||||||
ESP_LOGE(TAG, "failed to validate PHY data partition, restoring default data into flash...");
|
ESP_LOGE(TAG, "failed to validate PHY data partition, restoring default data into flash...");
|
||||||
@@ -1013,6 +1014,12 @@ esp_err_t esp_phy_update_country_info(const char *country)
|
|||||||
{
|
{
|
||||||
#if CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN
|
#if CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN
|
||||||
uint8_t phy_init_data_type_map = 0;
|
uint8_t phy_init_data_type_map = 0;
|
||||||
|
|
||||||
|
if (!s_multiple_phy_init_data_bin) {
|
||||||
|
ESP_LOGD(TAG, "Does not support multiple PHY init data bins");
|
||||||
|
return ESP_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
//if country equal s_phy_current_country, return;
|
//if country equal s_phy_current_country, return;
|
||||||
if (!memcmp(country, s_phy_current_country, sizeof(s_phy_current_country))) {
|
if (!memcmp(country, s_phy_current_country, sizeof(s_phy_current_country))) {
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
@@ -1020,11 +1027,6 @@ esp_err_t esp_phy_update_country_info(const char *country)
|
|||||||
|
|
||||||
memcpy(s_phy_current_country, country, sizeof(s_phy_current_country));
|
memcpy(s_phy_current_country, country, sizeof(s_phy_current_country));
|
||||||
|
|
||||||
if (!s_multiple_phy_init_data_bin) {
|
|
||||||
ESP_LOGD(TAG, "Does not support multiple PHY init data bins");
|
|
||||||
return ESP_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
phy_init_data_type_map = phy_find_bin_type_according_country(country);
|
phy_init_data_type_map = phy_find_bin_type_according_country(country);
|
||||||
if (phy_init_data_type_map == s_phy_init_data_type) {
|
if (phy_init_data_type_map == s_phy_init_data_type) {
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
Reference in New Issue
Block a user