Skip to content

fix(msc_test): fopen Werror=use-after-free#352

Merged
peter-marcisovsky merged 1 commit intomasterfrom
fix/use_after_free_fopen
Dec 11, 2025
Merged

fix(msc_test): fopen Werror=use-after-free#352
peter-marcisovsky merged 1 commit intomasterfrom
fix/use_after_free_fopen

Conversation

@peter-marcisovsky
Copy link
Collaborator

@peter-marcisovsky peter-marcisovsky commented Dec 10, 2025

Description

Fixing build error of msc test app to unblock CI

Error error
/__w/esp-usb/esp-usb/host/class/msc/usb_host_msc/test_app/main/test_msc.c: In function 'write_read_file':
/__w/esp-usb/esp-usb/host/class/msc/usb_host_msc/test_app/main/test_msc.c:165:5: error: pointer 'f' may be used after 'fclose' [-Werror=use-after-free]
  165 |     fclose(f);
      |     ^~~~~~~~~
/__w/esp-usb/esp-usb/host/class/msc/usb_host_msc/test_app/main/test_msc.c:160:5: note: call to 'fclose' here
  160 |     fclose(f);
      |     ^~~~~~~~~
/__w/esp-usb/esp-usb/host/class/msc/usb_host_msc/test_app/main/test_msc.c:164:5: error: pointer 'f' may be used after 'fclose' [-Werror=use-after-free]
  164 |     fgets(line, sizeof(line), f);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/__w/esp-usb/esp-usb/host/class/msc/usb_host_msc/test_app/main/test_msc.c:160:5: note: call to 'fclose' here
  160 |     fclose(f);
      |     ^~~~~~~~~
cc1: all warnings being treated as errors
[712/719] Building C object esp-idf/esp_tinyusb/CMakeFiles/__idf_esp_tinyusb.dir/tinyusb_msc.c.obj
ninja: build stopped: subcommand failed.
HINT: The warning(s) '-Werror=use-after-free' may appear after compiler update above [](https://jira.espressif.com:8443/browse/)

Related

Testing


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@peter-marcisovsky peter-marcisovsky merged commit bfd9eb7 into master Dec 11, 2025
67 checks passed
@peter-marcisovsky peter-marcisovsky deleted the fix/use_after_free_fopen branch December 11, 2025 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: usb_host Issue affects usb_host component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants