aboutsummaryrefslogtreecommitdiffstats
path: root/pony_spi.c
diff options
context:
space:
mode:
authoraarya <aarya.chaumal@gmail.com>2022-03-10 08:28:55 +0530
committerAnastasia Klimchuk <aklm@chromium.org>2022-03-25 00:57:26 +0000
commitcaa0335114a817a69b43e5bc32ec9a5c2c65c896 (patch)
treec05f45a406fcafa7a4463f391379e668191bc3ad /pony_spi.c
parent1b1066e2d5db21167394e0d40dfe5a0d370c8852 (diff)
downloadflashrom-caa0335114a817a69b43e5bc32ec9a5c2c65c896.tar.gz
flashrom-caa0335114a817a69b43e5bc32ec9a5c2c65c896.tar.bz2
flashrom-caa0335114a817a69b43e5bc32ec9a5c2c65c896.zip
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>
Diffstat (limited to 'pony_spi.c')
-rw-r--r--pony_spi.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/pony_spi.c b/pony_spi.c
index 86ef238c..a3ac274f 100644
--- a/pony_spi.c
+++ b/pony_spi.c
@@ -161,6 +161,7 @@ static int pony_spi_init(void)
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;
}