Skip to content

Commit

Permalink
fixed config parse crash after flash_erase
Browse files Browse the repository at this point in the history
Closes #6170
  • Loading branch information
xiongweichao committed Jan 7, 2022
1 parent 9f0c9ff commit ae676e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/bt/common/osi/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
char *keyname = osi_calloc(keyname_bufsz);
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
goto error;
}
buf = osi_calloc(buf_size);
if (!line || !section || !buf || !keyname) {
err_code |= 0x01;
goto error;
Expand Down

0 comments on commit ae676e3

Please sign in to comment.