util/ifdtool: Fix memory leaks

This allows building coreboot with AddressSanitizer on ChromeOS.
Otherwise these memory leaks are detected which cause the build to fail.

Change-Id: Ife6114db99278c9a3fb8271410486b057ef822f6
Signed-off-by: Matt Turner <mattst88@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85684
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
Matt Turner 2024-12-19 18:00:38 -05:00 committed by Stefan Reinauer
commit 9eb4c5aff8

View file

@ -2246,8 +2246,7 @@ int main(int argc, char *argv[])
int mode_layout = 0, mode_newlayout = 0, mode_density = 0, mode_setstrap = 0;
int mode_read = 0, mode_altmedisable = 0, altmedisable = 0, mode_fmap_template = 0;
int mode_gpr0_disable = 0, mode_gpr0_enable = 0, mode_gpr0_status = 0;
char *region_type_string = NULL, *region_fname = NULL;
const char *layout_fname = NULL;
char *region_type_string = NULL, *region_fname = NULL, *layout_fname = NULL;
char *new_filename = NULL;
int region_type = -1, inputfreq = 0;
unsigned int value = 0;
@ -2682,6 +2681,8 @@ int main(int argc, char *argv[])
write_image(new_filename, image, size);
}
free(region_type_string);
free(layout_fname);
free(new_filename);
free(image);