]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libelf: Fix possible memory leak in elf_getdata_rawchunk
authorMark Wielaard <mark@klomp.org>
Wed, 8 Nov 2023 12:50:01 +0000 (13:50 +0100)
committerMark Wielaard <mark@klomp.org>
Tue, 14 Nov 2023 13:24:44 +0000 (14:24 +0100)
commitb21b4dfc23c2c812147428a39999be9f3cb4615f
treeb05a3d97f42b2e9689180e37244ae00e7f4f9385
parent950e43ba40e8f4be53cf06f5b360073a27bbb4ac
libelf: Fix possible memory leak in elf_getdata_rawchunk

If the rawchunk is not properly aligned we'll create a new buffer
that is correctly aligned and put the data in that new buffer with
memcpy or the conversion function. In such cases the rawchunk leaks
because the new buffer is put into the Elf_Data_Chunk.

* libelf/elf_getdata_rawchunk.c (elf_getdata_rawchunk):
Call free on the rawchunk if new buffer was allocated.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libelf/elf_getdata_rawchunk.c