-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Copy link
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Milestone
Description
Problem
1. File descriptor leak in pkg/fanal/artifact/vm/file.go
In the newFile() function (line 39), a file is opened:
f, err := os.Open(filePath)When errors occur on lines 46, 52, or 60, the function returns without closing the file descriptor, causing a resource leak.
2. Pipe resource leak in pkg/flag/options.go
In the outputPluginWriter() function (line 585), pipes are created:
pr, pw := io.Pipe()When an error occurs on line 591, the function returns without closing these pipe resources.
Impact
Resources are not properly closed on error paths, leading to potential resource leaks.
Solution
Implement proper cleanup using defer statements with named error returns to ensure resources are closed on all error paths.
References
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Type
Projects
Status
No status