From caa0335114a817a69b43e5bc32ec9a5c2c65c896 Mon Sep 17 00:00:00 2001 From: aarya Date: Thu, 10 Mar 2022 08:28:55 +0530 Subject: 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 Reviewed-on: https://review.coreboot.org/c/flashrom/+/62724 Tested-by: build bot (Jenkins) Reviewed-by: Felix Singer Reviewed-by: Nico Huber Reviewed-by: Anastasia Klimchuk --- pony_spi.c | 1 + 1 file changed, 1 insertion(+) (limited to 'pony_spi.c') 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; } -- cgit v1.2.3