Skip to content

Commit

Permalink
close memory stream before returning on parsing error - release
Browse files Browse the repository at this point in the history
  • Loading branch information
philippe44 committed Aug 10, 2021
1 parent 6e082a5 commit c4bd320
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/platform_console/cmd_config.c
Expand Up @@ -306,6 +306,7 @@ static int do_bt_source_cmd(int argc, char **argv){
}
if(nerrors >0){
arg_print_errors(f,bt_source_args.end,desc_bt_source);
fclose(f);
return 1;
}

Expand Down Expand Up @@ -416,6 +417,7 @@ static int do_audio_cmd(int argc, char **argv){
}
if(nerrors >0){
arg_print_errors(f,audio_args.end,desc_audio);
fclose(f);
return 1;
}

Expand Down Expand Up @@ -479,6 +481,7 @@ static int do_spdif_cmd(int argc, char **argv){
}
if(nerrors >0){
arg_print_errors(f,spdif_args.end,desc_dac);
fclose(f);
return 1;
}
nerrors+=is_output_gpio(spdif_args.clock, f, &i2s_dac_pin.pin.bck_io_num, true);
Expand Down Expand Up @@ -517,6 +520,7 @@ static int do_rotary_cmd(int argc, char **argv){
}
if(nerrors >0){
arg_print_errors(f,rotary_args.end,desc_rotary);
fclose(f);
return 1;
}
nerrors+=is_gpio(rotary_args.A, f, &rotary.A, true,false);
Expand Down Expand Up @@ -584,6 +588,7 @@ static int do_i2s_cmd(int argc, char **argv)
}
if(nerrors >0){
arg_print_errors(f,i2s_args.end,desc_dac);
fclose(f);
return 1;
}
nerrors+=is_output_gpio(i2s_args.clock, f, &i2s_dac_pin.pin.bck_io_num, true);
Expand Down Expand Up @@ -805,6 +810,7 @@ cJSON * squeezelite_cb(){
argv = (char **) calloc(22, sizeof(char *));
if (argv == NULL) {
FREE_AND_NULL(nvs_config);
fclose(f);
return values;
}
size_t argc = esp_console_split_argv(nvs_config, argv,22);
Expand Down
3 changes: 3 additions & 0 deletions components/platform_console/cmd_i2ctools.c
Expand Up @@ -324,6 +324,7 @@ static int do_i2c_set_display(int argc, char **argv)
}
if(nerrors>0){
arg_print_errors(f,i2cdisp_args.end,desc_display);
fclose(f);
return 1;
}
/* Check "--type" option */
Expand Down Expand Up @@ -446,6 +447,7 @@ static int do_spiconfig_cmd(int argc, char **argv){
}
if(nerrors>0){
arg_print_errors(f,spiconfig_args.end,desc_spiconfig);
fclose(f);
return 1;
}
/* Check "--clk" option */
Expand Down Expand Up @@ -520,6 +522,7 @@ static int do_i2cconfig_cmd(int argc, char **argv)
}
if(nerrors>0){
arg_print_errors(f,i2cconfig_args.end,desc_i2c);
fclose(f);
return 1;
}
/* Check "--port" option */
Expand Down

0 comments on commit c4bd320

Please sign in to comment.