libflashrom: Free `chip` instance upon flashctx teardown
Change-Id: I761d7e167a43e5bf08b5b3d269b0a476e3d343c5
Signed-off-by: Nico Huber <nico.h@gmx.de>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/33546
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71396
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/libflashrom.c b/libflashrom.c
index f8c90e0..19a41cf 100644
--- a/libflashrom.c
+++ b/libflashrom.c
@@ -206,6 +206,7 @@
ret = 0;
/* We found one chip, now check that there is no second match. */
if (probe_flash(®istered_masters[i], flash_idx + 1, &second_flashctx, 0) != -1) {
+ free(second_flashctx.chip);
ret = 3;
break;
}
@@ -236,6 +237,7 @@
*/
void flashrom_flash_release(struct flashrom_flashctx *const flashctx)
{
+ free(flashctx->chip);
free(flashctx);
}