Aarya Chaumal has uploaded this change for review.
pony_spi.c: Fixed memory leak in function pony_init_spi
Memory leaked was caused as data variable wasn't deallocated in some error cases where
the function returned without deallocatiing it.
Change-Id: I7910db94f63693e7f131836d4963e88cfdbec301
Signed-off-by: Aarya Chaumal <aarya.chaumal@gmail.com>
---
M pony_spi.c
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/24/62724/1
diff --git a/pony_spi.c b/pony_spi.c
index 86ef238..9f61d54 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;
}
@@ -178,6 +179,7 @@
} else if (arg){
msg_perr("Error: Invalid programmer type specified.\n");
free(arg);
+ free(data);
return 1;
}
free(arg);
@@ -243,12 +245,15 @@
if (!have_prog) {
msg_perr("No programmer compatible with %s detected.\n", name);
+ free(data);
return 1;
}
if (register_spi_bitbang_master(&bitbang_spi_master_pony, data))
return 1;
+ free(data);
+
return 0;
}
To view, visit change 62724. To unsubscribe, or for help writing mail filters, visit settings.