Repository navigation
Conversation
added 2 commits
November 17, 2026 14:15
Add the missing blank lines after declarations in critmon.c so that the file passes the whole-file style check. Whitespace only, no functional change. Assisted-by: Kiro Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
In critmon_process_directory(), when the first fgets() on /proc/<pid>/critmon returns NULL (the task can exit between the fopen() and the read, or the read itself can fail), the error path jumped to errout_with_filepath, skipping fclose(stream) and leaking the open FILE (and its underlying fd and libc buffer) on every such failure. Jump to errout_with_stream instead so the stream is closed, matching the success path which also falls through to errout_with_stream. Assisted-by: Kiro Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
xiaoxiang781216
approved these changes
Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In
critmon_process_directory(), when the firstfgets()on/proc/<pid>/critmonreturns NULL (the task can exit betweenfopen()andthe read), the error path jumped to
errout_with_filepathand skippedfclose(stream), leaking the FILE, its fd and its buffer each time. It nowjumps 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 wholetouched 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 7f4e538.
sim:nsh+CONFIG_SCHED_CRITMONITOR=y,CONFIG_SYSTEM_CRITMONITOR=y:tools/checkpatch.sh -c -u -m -gpasses.