This is an automated email from the ASF dual-hosted git repository. GUIDINGLI pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit e1b21acd5cdececbc9a4acde5e1b9782bc0aff1f Author: yukangzhi <[email protected]> AuthorDate: Fri Oct 30 12:12:22 2026 +0800 system/critmon: fix FILE stream leak on critmon read failure. 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 <[email protected]> --- system/critmon/critmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/critmon/critmon.c b/system/critmon/critmon.c index d2d7b1d4b..9076f711e 100644 --- a/system/critmon/critmon.c +++ b/system/critmon/critmon.c @@ -213,7 +213,7 @@ static int critmon_process_directory(FAR struct dirent *entryp) ret = -errno; fprintf(stderr, "Csection Monitor: Failed to read from %s: %d\n", filepath, ret); - goto errout_with_filepath; + goto errout_with_stream; } /* Input Format: X.XXXXXXXXX,X.XXXXXXXXX,X.XXXXXXXXX
