From: Ulf Hermann <ulf.hermann@qt.io>
To: <elfutils-devel@sourceware.org>
Subject: [PATCH] On elf_update, remember when we mmap()
Date: Thu, 20 Apr 2017 14:57:00 -0000 [thread overview]
Message-ID: <a878a574-ac2e-c371-862e-254b83670df9@qt.io> (raw)
Otherwise we skip the munmap() later. This leaks resources.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
libelf/ChangeLog | 4 ++++
libelf/elf_update.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index fa768f8..225c7c8 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,5 +1,9 @@
2017-04-20 Ulf Hermann <ulf.hermann@qt.io>
+ * elf_update.c: Set ELF_F_MMAPPED flag if we mmap from elf_update.
+
+2017-04-20 Ulf Hermann <ulf.hermann@qt.io>
+
* libelfP.h: Don't include config.h.
2017-04-20 Ulf Hermann <ulf.hermann@qt.io>
diff --git a/libelf/elf_update.c b/libelf/elf_update.c
index c635eb3..8ce0782 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)
--
2.1.4
next reply other threads:[~2017-04-20 14:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-20 14:57 Ulf Hermann [this message]
2017-04-28 8:48 ` Mark Wielaard
2017-04-28 11:15 ` Ulf Hermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a878a574-ac2e-c371-862e-254b83670df9@qt.io \
--to=ulf.hermann@qt.io \
--cc=elfutils-devel@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).