summaryrefslogtreecommitdiff
path: root/libelf/elf_update.c
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-04-20 16:57:41 +0200
committerMark Wielaard <mark@klomp.org>2017-04-28 00:14:56 +0200
commita6c6fb4ae497a086e75f9436b67a1de4564bfb91 (patch)
tree6e784ca83c589a211d01d09df2ba952a0f6d845a /libelf/elf_update.c
parentd6655d9995e3fa9a2318261ec3ef5fc54996f69c (diff)
downloadelfutils-a6c6fb4ae497a086e75f9436b67a1de4564bfb91.tar.gz
On elf_update, remember when we mmap()
Otherwise we skip the munmap() later. This leaks resources. Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'libelf/elf_update.c')
-rw-r--r--libelf/elf_update.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libelf/elf_update.c b/libelf/elf_update.c
index c635eb32..8ce07829 100644
--- a/libelf/elf_update.c
+++ b/libelf/elf_update.c
@@ -74,6 +74,8 @@ write_file (Elf *elf, off_t size, int change_bo, size_t shnum)
MAP_SHARED, elf->fildes, 0);
if (unlikely (elf->map_address == MAP_FAILED))
elf->map_address = NULL;
+ else
+ elf->flags |= ELF_F_MMAPPED;
}
if (elf->map_address != NULL)