Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34412 )
Change subject: util/cbfstool/flashmap: Fix memory leaks on failed tests ......................................................................
util/cbfstool/flashmap: Fix memory leaks on failed tests
These don't matter much, but it keeps Coverity happy.
Change-Id: Ie750acb50ae1590c3aea533338a8827c03459c1a Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 1302452, 1302453 --- M util/cbfstool/flashmap/fmap.c 1 file changed, 4 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/12/34412/1
diff --git a/util/cbfstool/flashmap/fmap.c b/util/cbfstool/flashmap/fmap.c index 06f179f..e6992c8 100644 --- a/util/cbfstool/flashmap/fmap.c +++ b/util/cbfstool/flashmap/fmap.c @@ -509,7 +509,8 @@
static int fmap_flags_to_string_test(void) { - char *str, *my_str; + char *str = NULL; + char *my_str = NULL; unsigned int i; uint16_t flags;
@@ -555,11 +556,11 @@ printf("FAILURE: bad result from fmap_flags_to_string\n"); goto fmap_flags_to_string_test_exit; } - free(my_str); - free(str);
status = pass; fmap_flags_to_string_test_exit: + free(str); + free(my_str); return status;
}
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34412
to look at the new patch set (#2).
Change subject: util/cbfstool/flashmap: Fix memory leaks on failure ......................................................................
util/cbfstool/flashmap: Fix memory leaks on failure
Fix several memory leaks on failed printing or tests. These don't matter much, but it keeps Coverity happy.
Change-Id: Ie750acb50ae1590c3aea533338a8827c03459c1a Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 130245{1,2,3} --- M util/cbfstool/flashmap/fmap.c 1 file changed, 8 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/12/34412/2
HAOUAS Elyes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34412 )
Change subject: util/cbfstool/flashmap: Fix memory leaks on failure ......................................................................
Patch Set 2: Code-Review+1
HAOUAS Elyes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34412 )
Change subject: util/cbfstool/flashmap: Fix memory leaks on failure ......................................................................
Patch Set 2: Code-Review+2
Martin Roth has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/34412 )
Change subject: util/cbfstool/flashmap: Fix memory leaks on failure ......................................................................
util/cbfstool/flashmap: Fix memory leaks on failure
Fix several memory leaks on failed printing or tests. These don't matter much, but it keeps Coverity happy.
Change-Id: Ie750acb50ae1590c3aea533338a8827c03459c1a Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 130245{1,2,3} Reviewed-on: https://review.coreboot.org/c/coreboot/+/34412 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: HAOUAS Elyes ehaouas@noos.fr --- M util/cbfstool/flashmap/fmap.c 1 file changed, 8 insertions(+), 4 deletions(-)
Approvals: build bot (Jenkins): Verified HAOUAS Elyes: Looks good to me, approved
diff --git a/util/cbfstool/flashmap/fmap.c b/util/cbfstool/flashmap/fmap.c index 06f179f..6255fc5 100644 --- a/util/cbfstool/flashmap/fmap.c +++ b/util/cbfstool/flashmap/fmap.c @@ -236,8 +236,11 @@
/* Print descriptive strings for flags rather than the field */ flags = fmap->areas[i].flags; - if ((str = fmap_flags_to_string(flags)) == NULL) + str = fmap_flags_to_string(flags); + if (str == NULL) { + kv_pair_free(pair); return -1; + } kv_pair_fmt(pair, "area_flags", "%s", str); free(str);
@@ -509,7 +512,8 @@
static int fmap_flags_to_string_test(void) { - char *str, *my_str; + char *str = NULL; + char *my_str = NULL; unsigned int i; uint16_t flags;
@@ -555,11 +559,11 @@ printf("FAILURE: bad result from fmap_flags_to_string\n"); goto fmap_flags_to_string_test_exit; } - free(my_str); - free(str);
status = pass; fmap_flags_to_string_test_exit: + free(str); + free(my_str); return status;
}