diff options
author | Mark Wielaard <[email protected]> | 2015-12-19 01:29:54 +0100 |
---|---|---|
committer | Mark Wielaard <[email protected]> | 2016-01-06 14:27:10 +0100 |
commit | 272018bba1f253bae00b5ba280ad0e0f18c04006 (patch) | |
tree | f0b20b43f9caf6d193ae9c05f5583699f34bc59d /libelf/elf_end.c | |
parent | b7105b40ccd73a8e6b7fce6c11d2088eb1298b33 (diff) |
libelf: Add elf_compress and elf_compress_gnu.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libelf/elf_end.c')
-rw-r--r-- | libelf/elf_end.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libelf/elf_end.c b/libelf/elf_end.c index 7ea876c3..fde17b50 100644 --- a/libelf/elf_end.c +++ b/libelf/elf_end.c @@ -150,6 +150,12 @@ elf_end (Elf *elf) /* It doesn't matter which pointer. */ free (scn->shdr.e32); + /* Free zdata if uncompressed, but not yet used as + rawdata_base. If it is already used it will be + freed below. */ + if (scn->zdata_base != scn->rawdata_base) + free (scn->zdata_base); + /* If the file has the same byte order and the architecture doesn't require overly stringent alignment the raw data buffer is the same as the @@ -158,8 +164,9 @@ elf_end (Elf *elf) free (scn->data_base); /* The section data is allocated if we couldn't mmap - the file. */ - if (elf->map_address == NULL) + the file. Or if we had to decompress. */ + if (elf->map_address == NULL + || scn->rawdata_base == scn->zdata_base) free (scn->rawdata_base); /* Free the list of data buffers for the section. |