diff options
author | Mark Wielaard <mjw@redhat.com> | 2015-10-21 01:33:56 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2015-11-02 16:32:39 +0100 |
commit | 1362745282b44aac8d9b1a4fd7cc250d1b797cc5 (patch) | |
tree | 0c036073e0fafc5f69acfe64be3ae70726628b84 /libelf/elf_end.c | |
parent | b1a665cf5efc1661dc6cda0b74155052145ee3c6 (diff) | |
download | elfutils-1362745282b44aac8d9b1a4fd7cc250d1b797cc5.tar.gz |
libelf: Add elf_compress and elf_compress_gnu.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
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. |