public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] libdwfl: Don't leak fd on error in linux-proc-maps.c (grovel_auxv).
@ 2014-05-15 14:58 Mark Wielaard
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2014-05-15 14:58 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 libdwfl/ChangeLog         |    4 ++++
 libdwfl/linux-proc-maps.c |    6 +++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 2cf0752..2fd2a1a 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,7 @@
+2014-05-15  Mark Wielaard  <mjw@redhat.com>
+
+	* linux-proc-maps.c (grovel_auxv): Close fd on error.
+
 2014-05-02  Mark Wielaard  <mjw@redhat.com>
 
 	* dwfl_module_getdwarf: Remove ENABLE_DWZ ifdefs so find_debug_altlink
diff --git a/libdwfl/linux-proc-maps.c b/libdwfl/linux-proc-maps.c
index b6620ac..d085834 100644
--- a/libdwfl/linux-proc-maps.c
+++ b/libdwfl/linux-proc-maps.c
@@ -116,7 +116,11 @@ grovel_auxv (pid_t pid, Dwfl *dwfl, GElf_Addr *sysinfo_ehdr)
       eu_static_assert (sizeof d.a64 == sizeof d.a32);
       nread = pread_retry (fd, d.a64, sizeof d.a64, offset);
       if (nread < 0)
-	return errno;
+	{
+	  int ret = errno;
+	  close (fd);
+	  return ret;
+	}
       for (size_t a32i = 0; a32i < nread / sizeof d.a32[0]; a32i++)
 	{
 	  const Elf32_auxv_t *a32 = d.a32 + a32i;
-- 
1.7.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libdwfl: Don't leak fd on error in linux-proc-maps.c (grovel_auxv).
@ 2014-05-17 20:18 Mark Wielaard
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2014-05-17 20:18 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 113 bytes --]

On Fri, May 16, 2014 at 01:36:31PM +0200, Petr Machata wrote:
> Looks good to me.

Thanks. Pushed to master.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libdwfl: Don't leak fd on error in linux-proc-maps.c (grovel_auxv).
@ 2014-05-16 11:36 Petr Machata
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Machata @ 2014-05-16 11:36 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 34 bytes --]

Looks good to me.

Thanks,
PM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-17 20:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-15 14:58 [PATCH] libdwfl: Don't leak fd on error in linux-proc-maps.c (grovel_auxv) Mark Wielaard
2014-05-16 11:36 Petr Machata
2014-05-17 20:18 Mark Wielaard

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).