mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 11:17:20 +02:00
Merge branch 'bugfix/config_parse_crash_after_flash_erase_v4.1' into 'release/v4.1'
component_bt: fixed config parse crash after flash_erase(v4.1) See merge request espressif/esp-idf!16732
This commit is contained in:
@ -550,10 +550,12 @@ static void config_parse(nvs_handle_t fp, config_t *config)
|
|||||||
const size_t keyname_bufsz = sizeof(CONFIG_KEY) + 5 + 1; // including log10(sizeof(i))
|
const size_t keyname_bufsz = sizeof(CONFIG_KEY) + 5 + 1; // including log10(sizeof(i))
|
||||||
char *keyname = osi_calloc(keyname_bufsz);
|
char *keyname = osi_calloc(keyname_bufsz);
|
||||||
int buf_size = get_config_size_from_flash(fp);
|
int buf_size = get_config_size_from_flash(fp);
|
||||||
char *buf = osi_calloc(buf_size);
|
char *buf = NULL;
|
||||||
|
|
||||||
if(buf_size == 0) { //First use nvs
|
if(buf_size == 0) { //First use nvs
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
buf = osi_calloc(buf_size);
|
||||||
if (!line || !section || !buf || !keyname) {
|
if (!line || !section || !buf || !keyname) {
|
||||||
err_code |= 0x01;
|
err_code |= 0x01;
|
||||||
goto error;
|
goto error;
|
||||||
|
Reference in New Issue
Block a user