1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

libflashrom: Free chip instance upon flashctx teardown

Change-Id: I761d7e167a43e5bf08b5b3d269b0a476e3d343c5
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/33546
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Nico Huber 2019-06-16 20:07:28 +02:00
parent 194815a363
commit 73ae47ecc2

View File

@ -331,6 +331,7 @@ int flashrom_flash_probe(struct flashrom_flashctx **const flashctx,
/* We found one chip, now check that there is no second match. */ /* We found one chip, now check that there is no second match. */
if (probe_flash(&registered_masters[i], flash_idx + 1, &second_flashctx, 0) != -1) { if (probe_flash(&registered_masters[i], flash_idx + 1, &second_flashctx, 0) != -1) {
flashrom_layout_release(second_flashctx.default_layout); flashrom_layout_release(second_flashctx.default_layout);
free(second_flashctx.chip);
ret = 3; ret = 3;
break; break;
} }
@ -362,6 +363,7 @@ size_t flashrom_flash_getsize(const struct flashrom_flashctx *const flashctx)
void flashrom_flash_release(struct flashrom_flashctx *const flashctx) void flashrom_flash_release(struct flashrom_flashctx *const flashctx)
{ {
flashrom_layout_release(flashctx->default_layout); flashrom_layout_release(flashctx->default_layout);
free(flashctx->chip);
free(flashctx); free(flashctx);
} }