layout: Introduce flashrom_layout_new()
It initializes an empty layout. Currently the maximum number of entries
has to be specified, which will vanish once we use dynamic allocation
per entry.
We replace the two special cases `single_layout` and `ich_layout` with
dynamically allocated layouts. As a result, we have to take care to
release the `default_layout` in a flashctx once we are done with it.
Change-Id: I2ae7246493ff592e631cce924777925c7825e398
Signed-off-by: Nico Huber <nico.h@gmx.de>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/33543
Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72214
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/cli_classic.c b/cli_classic.c
index c490d3f..e0b5094 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -682,8 +682,10 @@
out_shutdown:
programmer_shutdown();
out:
- for (i = 0; i < chipcount; i++)
+ for (i = 0; i < chipcount; i++) {
+ flashrom_layout_release(flashes[i].default_layout);
free(flashes[i].chip);
+ }
layout_cleanup(&include_args);
free(filename);