Shahina Shaik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/69220 )
Change subject: UPSTREAM: cbfstool: Fix possible memory leak ......................................................................
UPSTREAM: cbfstool: Fix possible memory leak
Handle the possible memory leak scenario.
Foundby=klocwork BUG=NONE TEST=Boot to OS on Nivviks
Change-Id: I01c4643d1e671d9bd9971ac6db8031634fffd61e Signed-off-by: Shaik Shahina shahina.shaik@intel.com --- M util/cbfstool/cbfstool.c M util/cbfstool/common.c 2 files changed, 21 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/20/69220/1
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 04b91e5..a41bb27 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -771,7 +771,7 @@ if (param.topswap_size) { if (update_master_header_loc_topswap(&image, h_loc, header_offset)) - return 1; + goto done; }
ret = maybe_update_metadata_hash(&image); diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c index 8ae9120..52fad1c 100644 --- a/util/cbfstool/common.c +++ b/util/cbfstool/common.c @@ -34,6 +34,10 @@ if (!buffer->data) { fprintf(stderr, "buffer_create: Insufficient memory (0x%zx).\n", size); + if (buffer->name) { + free(buffer->name); + buffer->name = NULL; + } } return (buffer->data == NULL); }