mirror of
https://github.com/openharmony/third_party_elfutils.git
synced 2026-07-19 19:43:34 -04:00
libelf: Fix double free in __libelf_compress on error path.
In commit 2092865a7e
"libelf: {de,}compress: ensure zlib resource cleanup" we added a
call to deflate_cleanup to make sure all resources were freed.
As GCC10 -fanalyzer points out that could cause a double free
of out_buf. Fix by removing the free (out_buf) in __libelf_compress.
Signed-off-by: Mark Wielaard <mark@klomp.org>
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
2020-04-25 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* elf_compress.c (__libelf_compress): Remove free (out_buf).
|
||||
|
||||
2020-03-18 Omar Sandoval <osandov@fb.com>
|
||||
|
||||
* elf_getphdrnum.c (__elf_getphdrnum_rdlock): Call
|
||||
|
||||
@@ -113,7 +113,6 @@ __libelf_compress (Elf_Scn *scn, size_t hsize, int ei_data,
|
||||
int zrc = deflateInit (&z, Z_BEST_COMPRESSION);
|
||||
if (zrc != Z_OK)
|
||||
{
|
||||
free (out_buf);
|
||||
__libelf_seterrno (ELF_E_COMPRESS_ERROR);
|
||||
return deflate_cleanup(NULL, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user