summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2013-09-15 14:01:06 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2013-09-15 14:01:06 +0000
commit949ccc8a7ed2a7ad075103e064ad92483ffa8720 (patch)
tree8aaa82d92b1b7366c53552da0b089bf83f37e55f
parent88ee040ab98a1ffa0c7d8faf6aac1187500e4974 (diff)
downloadast2050-flashrom-949ccc8a7ed2a7ad075103e064ad92483ffa8720.zip
ast2050-flashrom-949ccc8a7ed2a7ad075103e064ad92483ffa8720.tar.gz
layout: Add a method to cleanup layout data structures
Add layout_cleanup() to layout.c and hook it up in cli_classic.c. Corresponding to flashrom svn r1749. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
-rw-r--r--cli_classic.c3
-rw-r--r--flash.h1
-rw-r--r--layout.c16
3 files changed, 18 insertions, 2 deletions
diff --git a/cli_classic.c b/cli_classic.c
index 4c71d07..70bccb5 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -221,8 +221,6 @@ int main(int argc, char *argv[])
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 @@ out:
for (i = 0; i < chipcount; i++)
free(flashes[i].chip);
+ layout_cleanup();
free(filename);
free(layoutfile);
free(pparam);
diff --git a/flash.h b/flash.h
index 63701ed..7b88477 100644
--- a/flash.h
+++ b/flash.h
@@ -320,6 +320,7 @@ int register_include_arg(char *name);
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 {
diff --git a/layout.c b/layout.c
index 8bb1666..86351b8 100644
--- a/layout.c
+++ b/layout.c
@@ -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 @@ int process_include_args(void)
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;
OpenPOWER on IntegriCloud