Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/69021 )
Change subject: util/cbfstool: fix memory leak in compress.c ......................................................................
util/cbfstool: fix memory leak in compress.c
free the memory allocated in lz4_compress function before returning from it.
Reported-by: Coverity (CID:1469433)
Signed-off-by: Solomon Alan-Dei alandei.solomon@gmail.com Change-Id: I8698090d519964348e51fc3b6f2023d06d81fcd5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/69021 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Julius Werner jwerner@chromium.org --- M util/cbfstool/compress.c 1 file changed, 22 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved
diff --git a/util/cbfstool/compress.c b/util/cbfstool/compress.c index 37fac22..96df1a7 100644 --- a/util/cbfstool/compress.c +++ b/util/cbfstool/compress.c @@ -23,9 +23,12 @@ if (!bounce) return -1; *out_len = LZ4F_compressFrame(bounce, worst_size, in, in_len, &prefs); - if (LZ4F_isError(*out_len) || *out_len >= in_len) + if (LZ4F_isError(*out_len) || *out_len >= in_len) { + free(bounce); return -1; + } memcpy(out, bounce, *out_len); + free(bounce); return 0; }