Anastasia Klimchuk submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, but someone else must approve Felix Singer: Looks good to me, but someone else must approve Anastasia Klimchuk: Looks good to me, approved
pony_spi.c: Fix memory leak in function pony_init_spi

The issue was found by running scan-build. Memory leak was caused as
data variable wasn't deallocated in some error cases where the
function returned without deallocating it. After making the change, the
issue no longer appeared in scan-build.

Change-Id: I7910db94f63693e7f131836d4963e88cfdbec301
Signed-off-by: Aarya Chaumal <aarya.chaumal@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/62724
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
---
M pony_spi.c
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/pony_spi.c b/pony_spi.c
index 86ef238..a3ac274 100644
--- a/pony_spi.c
+++ b/pony_spi.c
@@ -161,6 +161,7 @@
if (!have_device) {
msg_perr("Error: No valid device specified.\n"
"Use flashrom -p pony_spi:dev=/dev/device[,type=name]\n");
+ free(data);
return 1;
}


8 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one.

To view, visit change 62724. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I7910db94f63693e7f131836d4963e88cfdbec301
Gerrit-Change-Number: 62724
Gerrit-PatchSet: 13
Gerrit-Owner: Light <aarya.chaumal@gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Felix Singer <felixsinger@posteo.net>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus@gmail.com>
Gerrit-CC: Martin Roth <martinroth@google.com>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-MessageType: merged