Kaben123 opened a new pull request, #4067: URL: https://github.com/apache/nuttx-apps/pull/4067
## Summary In `critmon_process_directory()`, when the first `fgets()` on `/proc/<pid>/critmon` returns NULL (the task can exit between `fopen()` and the read), the error path jumped to `errout_with_filepath` and skipped `fclose(stream)`, leaking the FILE, its fd and its buffer each time. It now jumps to `errout_with_stream`, like the success path. The first commit fixes two existing nxstyle errors (missing blank lines after declarations) in `critmon.c`, because the CI style check runs on the whole touched file. It is whitespace only. ## Impact Bug fix only, no behavior change on the normal path. ## Testing Host: Ubuntu 22.04 x86_64, GCC 13.1.0. Base: apache/nuttx master 5c1746778e8, apache/nuttx-apps master 7f4e5382d. `sim:nsh` + `CONFIG_SCHED_CRITMONITOR=y`, `CONFIG_SYSTEM_CRITMONITOR=y`: ``` nsh> critmon PRE-EMPTION CALLER CSECTION CALLER RUN TIME PID DESCRIPTION None None ---------------- ---------------- ---- CPU 0 None None 0.510081193 2.808088665 0 Idle_Task None None 0.000004938 0.000004938 1 sim_loop_wq None None 0.000039973 0.000067983 2 hpwork None None 0.000144388 0.000262198 4 init_main None None 0.000376213 0.000901651 7 sh None None 0.000000000 0.000000000 8 critmon nsh> free ``` `tools/checkpatch.sh -c -u -m -g` passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
