Donny9 commented on code in PR #16431: URL: https://github.com/apache/nuttx/pull/16431#discussion_r2104225346
########## fs/inode/fs_files.c: ########## @@ -482,11 +482,11 @@ void files_putlist(FAR struct filelist *list) { file_close(&list->fl_files[i][j]); } + } - if (i != 0) - { - fs_heap_free(list->fl_files[i]); - } + for (i = list->fl_rows - 1; i > 0; i--) Review Comment: @pussuw No, you definitely haven't read my commit message carefully. The reason is that there are **many file descriptors (fds) that are interdependent,** and they may not all be on the same line in the list; they can span multiple lines. If, when closing one fd, you try to access another fd that has already been closed, but the line it was on may have already been freed, it could lead to a Use-After-Free (UAF) issue. Therefore, we need to release all the memory uniformly at the end. -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org