summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2020-04-23 09:26:12 +0200
committerAngel Pons <th3fanbus@gmail.com>2020-04-24 08:20:31 +0000
commit1cef9369234c99a2c23d319c11e48715e5cc07ef (patch)
treee350acdba2a58ca2ed22f07396dfc353b6ed1f7c
parent577c6b7fb965470e1e8158145b60a21da3b8f1b7 (diff)
downloadflashrom-1cef9369234c99a2c23d319c11e48715e5cc07ef.tar.gz
flashrom-1cef9369234c99a2c23d319c11e48715e5cc07ef.tar.bz2
flashrom-1cef9369234c99a2c23d319c11e48715e5cc07ef.zip
raiden_debug_spi: Fix memleak
Change-Id: I2701a8fbae63657edc9cc258666cc951f92b1115 Found-by: Coverity Scan #1420204 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/40650 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
-rw-r--r--raiden_debug_spi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c
index 173e35542..a0d65783a 100644
--- a/raiden_debug_spi.c
+++ b/raiden_debug_spi.c
@@ -480,12 +480,14 @@ int raiden_debug_spi_init(void)
ret = LIBUSB(libusb_init(NULL));
if (ret != 0) {
msg_perr("Raiden: libusb_init failed\n");
+ free(serial);
return ret;
}
ret = usb_device_find(&match, &current);
if (ret != 0) {
msg_perr("Raiden: Failed to find devices\n");
+ free(serial);
return ret;
}
@@ -546,6 +548,7 @@ loop_end:
if (!device || !found) {
msg_perr("Raiden: No usable device found.\n");
+ free(serial);
return 1;
}