Anastasia Klimchuk submitted this change.
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;
}
To view, visit change 62724. To unsubscribe, or for help writing mail filters, visit settings.