Skip to content

util: fix memory leak in read_binary_file() - #3668

Open
bellis-ibm wants to merge 1 commit into
linux-nvme:masterfrom
bellis-ibm:fix-read-binary-file-memory-leak-v2
Open

util: fix memory leak in read_binary_file()#3668
bellis-ibm wants to merge 1 commit into
linux-nvme:masterfrom
bellis-ibm:fix-read-binary-file-memory-leak-v2

Conversation

@bellis-ibm

Copy link
Copy Markdown
Contributor

The function returns NULL on all paths including success, leaking the allocated buffer. A duplicate unreachable goto also prevented the file from being closed on allocation failure.

Return buffer at the cleanup label and fix the goto target to close the file on the error path.

Signed-off-by: Brooke Ellis Brooke.Ellis@ibm.com

The function returns NULL on all paths including success, leaking
the allocated buffer. A duplicate unreachable goto also prevented
the file from being closed on allocation failure.

Return buffer at the cleanup label and fix the goto target to
close the file on the error path.

Signed-off-by: Brooke Ellis <Brooke.Ellis@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant