diff options
author | Thomas Heijligen <thomas.heijligen@secunet.com> | 2021-10-25 21:38:43 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2021-11-01 14:03:27 +0000 |
commit | fac2bfe54caa162f5c6109c5f5c471471e81cc22 (patch) | |
tree | 636fb4e5b793000979c97e0a2653774c5a9fda77 | |
parent | b3df1390dc8949cf909d2a037acfc56793bb3380 (diff) | |
download | flashrom-fac2bfe54caa162f5c6109c5f5c471471e81cc22.tar.gz flashrom-fac2bfe54caa162f5c6109c5f5c471471e81cc22.tar.bz2 flashrom-fac2bfe54caa162f5c6109c5f5c471471e81cc22.zip |
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>
-rw-r--r-- | pony_spi.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/pony_spi.c b/pony_spi.c index 6005bd4c2..86ef238cf 100644 --- a/pony_spi.c +++ b/pony_spi.c @@ -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) { |