Nico Huber submitted this change.
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.