mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 15:12:36 +02:00
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>
This commit is contained in:
parent
b3df1390dc
commit
fac2bfe54c
@ -145,6 +145,7 @@ static int pony_spi_init(void)
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user