Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Angel Pons: Looks good to me, approved
pony_spi: fix memory leak

Free data if sp_openserport() fails and pony_spi_init() returns early
with 1.

Change-Id: I11858bd0bdfe8b6d03af616fe4be4fb047b8dcd9
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/58583
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M pony_spi.c
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/pony_spi.c b/pony_spi.c
index 6005bd4..86ef238 100644
--- a/pony_spi.c
+++ b/pony_spi.c
@@ -145,6 +145,7 @@
sp_fd = sp_openserport(arg, 9600);
if (sp_fd == SER_INV_FD) {
free(arg);
+ free(data);
return 1;
}
if (register_shutdown(pony_spi_shutdown, data) != 0) {

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I11858bd0bdfe8b6d03af616fe4be4fb047b8dcd9
Gerrit-Change-Number: 58583
Gerrit-PatchSet: 4
Gerrit-Owner: Thomas Heijligen <src@posteo.de>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged