Author: stefanct Date: Sun Sep 15 16:01:06 2013 New Revision: 1749 URL: http://flashrom.org/trac/flashrom/changeset/1749
Log: layout: Add a method to cleanup layout data structures.
Add layout_cleanup() to layout.c and hook it up in cli_classic.c.
Signed-off-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Modified: trunk/cli_classic.c trunk/flash.h trunk/layout.c
Modified: trunk/cli_classic.c ============================================================================== --- trunk/cli_classic.c Sun Sep 15 01:37:01 2013 (r1748) +++ trunk/cli_classic.c Sun Sep 15 16:01:06 2013 (r1749) @@ -221,8 +221,6 @@ free(tempstr); cli_classic_abort_usage(); } - /* FIXME: A pointer to the image name is saved in a static array (of size MAX_ROMLAYOUT) - * by register_include_arg() and needs to be freed after processing them. */ break; case 'L': if (++operation_specified > 1) { @@ -527,6 +525,7 @@ for (i = 0; i < chipcount; i++) free(flashes[i].chip);
+ layout_cleanup(); free(filename); free(layoutfile); free(pparam);
Modified: trunk/flash.h ============================================================================== --- trunk/flash.h Sun Sep 15 01:37:01 2013 (r1748) +++ trunk/flash.h Sun Sep 15 16:01:06 2013 (r1749) @@ -320,6 +320,7 @@ int process_include_args(void); int read_romlayout(char *name); int handle_romentries(const struct flashctx *flash, uint8_t *oldcontents, uint8_t *newcontents); +void layout_cleanup(void);
/* spi.c */ struct spi_command {
Modified: trunk/layout.c ============================================================================== --- trunk/layout.c Sun Sep 15 01:37:01 2013 (r1748) +++ trunk/layout.c Sun Sep 15 16:01:06 2013 (r1749) @@ -3,6 +3,7 @@ * * Copyright (C) 2005-2008 coresystems GmbH * (Written by Stefan Reinauer stepan@coresystems.de for coresystems GmbH) + * Copyright (C) 2011-2013 Stefan Tauner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -189,6 +190,21 @@ return 0; }
+void layout_cleanup(void) +{ + int i; + for (i = 0; i < num_include_args; i++) { + free(include_args[i]); + include_args[i] = NULL; + } + num_include_args = 0; + + for (i = 0; i < num_rom_entries; i++) { + rom_entries[i].included = 0; + } + num_rom_entries = 0; +} + romentry_t *get_next_included_romentry(unsigned int start) { int i;