libflashrom.c: Fix unintialized value passed to function
In function flash_layout_read_from_ifd variable chip_layout remains
uninitialized if prepare_flash_access returns false. This uninitialized
variable (which contains a garbage value) is passed to
flashrom_layout_release. Thus initialize it with NULL. For completeness,
also initialize dump_layout with NULL.
Change-Id: Iacbd7bf9cdf897cc2a732c1dc6568845a4ab804d
Signed-off-by: Aarya Chaumal <aarya.chaumal@gmail.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/62725
Original-Reviewed-by: Felix Singer <felixsinger@posteo.net>
Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72311
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/libflashrom.c b/libflashrom.c
index 669a0a3..5c574fa 100644
--- a/libflashrom.c
+++ b/libflashrom.c
@@ -317,7 +317,7 @@
#ifndef __FLASHROM_LITTLE_ENDIAN__
return 6;
#else
- struct flashrom_layout *dump_layout, *chip_layout;
+ struct flashrom_layout *dump_layout = NULL, *chip_layout = NULL;
int ret = 1;
void *const desc = malloc(0x1000);