Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The file handle is now closed on the successful path, with no unresolved issues.
Review effort: Lite
Findings: None
What changed in this PR
Fixes a file resource leak in readFileToBuffer() by closing the opened file on successful reads.
Changes:
- Adds
fclose(infile)before the successful return. - Prevents leaked file handles without changing existing behavior.
| File | Summary |
|---|---|
source/core/wifi_passpoint.c |
Closes the file handle on successful reads. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Problem:
readFileToBuffer() does not close the file handle on the successful return path, causing a file resource leak.
Fix:
Added fclose(infile) before the successful return to properly release the file resource.
Signed-off-by: Yashodha KB <yakshagowda37@gmail.com>
tinaelizabeth84
force-pushed
the
RDKBDEV-3524-resource-leak
branch
from
October 1, 2026 13:37
47fa560 to
23e66e9
Compare
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.
Issue:
readFileToBuffer() opens the file using fopen(), but the file handle is not closed with fclose() on the successful return path, causing a file resource leak.
Steps to Reproduce:
Expected Behaviour:
The opened file should be properly closed before the function returns.
Fix:
Add fclose(infile) before the successful return.
Acceptance Criteria:
1.infile is closed using fclose() before returning.
2.No file resource leak is observed.
3.Existing functionality remains unchanged.