mirror of
https://github.com/openharmony/third_party_elfutils.git
synced 2026-07-16 07:44:26 -04:00
libelf: Fix possible resource leak in elf[32|64]_updatefile.
When we cannot allocate enough memory to convert the data in updatemmap we should free the scns before returning an error. Signed-off-by: Mark Wielaard <mark@klomp.org>
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2019-03-06 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* elf32_updatefile.c (updatemmap): Free scns before returning
|
||||
allocation failure.
|
||||
|
||||
2019-02-24 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* gelf_xlate.c (__elf_xfctstof): Remove alias.
|
||||
|
||||
@@ -365,6 +365,7 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
|
||||
char *converted = aligned_alloc (align, size);
|
||||
if (converted == NULL)
|
||||
{
|
||||
free (scns);
|
||||
__libelf_seterrno (ELF_E_NOMEM);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user