This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libelf: Fix memory leak in elf_compress for mmapped ELF files.


On Sun, Aug 07, 2016 at 10:38:58PM +0200, Mark Wielaard wrote:
> The testcase added to run-strip-reloc.sh for strip-compressed.o showed
> a memory leak when ran under valgrind (configure --enable-valgrind).
> 
> For a mmapped ELF file when existing section data was compressed
> elf_end would fail to release the new compressed data buffer assigned
> to rawdata_base. For non-mapped files rawdata_base is always freed.
> For decompressed data rawdata_base is released together with zdata_base.
> 
> Use the Elf_Scn flag ELF_T_MALLOCED to track whether rawdata_base
> points to malloced memory and free it in elf_end even for mmapped
> ELF files.

I pushed this to master.

Cheers,

Mark

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]