summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2014-04-26 16:11:21 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2014-04-26 16:11:21 +0000
commitc2a8b141f0b127b22a13e67e3d9a2498428f2e31 (patch)
tree211be2f03f42cec3b99157a5130694a71c2812ca
parent4cb5e64005a33da4e29ad87479cc37517af66b5c (diff)
downloadflashrom-c2a8b141f0b127b22a13e67e3d9a2498428f2e31.zip
flashrom-c2a8b141f0b127b22a13e67e3d9a2498428f2e31.tar.gz
CID1130011: Use after free in ich_descriptor_tool
Corresponding to flashrom svn r1771. Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
-rw-r--r--util/ich_descriptors_tool/ich_descriptors_tool.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/ich_descriptors_tool/ich_descriptors_tool.c b/util/ich_descriptors_tool/ich_descriptors_tool.c
index c359913..00ad1f3 100644
--- a/util/ich_descriptors_tool/ich_descriptors_tool.c
+++ b/util/ich_descriptors_tool/ich_descriptors_tool.c
@@ -77,12 +77,13 @@ static void dump_file(const char *prefix, const uint32_t *dump, unsigned int len
printf("Dumping %u bytes of the %s region from 0x%08x-0x%08x to %s... ",
file_len, region_names[i], base, limit, fn);
int fh = open(fn, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
- free(fn);
if (fh < 0) {
fprintf(stderr,
"ERROR: couldn't open(%s): %s\n", fn, strerror(errno));
+ free(fn);
exit(1);
}
+ free(fn);
ret = write(fh, &dump[base >> 2], file_len);
if (ret != file_len) {
OpenPOWER on IntegriCloud