Stefan Reinauer has submitted this change. ( https://review.coreboot.org/c/coreboot/+/85684?usp=email )
Change subject: util/ifdtool: Fix memory leaks ......................................................................
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 --- M util/ifdtool/ifdtool.c 1 file changed, 3 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Subrata Banik: Looks good to me, approved
diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c index ace05e2..94105ef 100644 --- a/util/ifdtool/ifdtool.c +++ b/util/ifdtool/ifdtool.c @@ -2246,8 +2246,7 @@ 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 @@ write_image(new_filename, image, size); }
+ free(region_type_string); + free(layout_fname); free(new_filename); free(image);