public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] nm: Fix descriptor leak
@ 2024-03-28 20:49 Maks Mishin
  2024-03-28 21:12 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Maks Mishin @ 2024-03-28 20:49 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Maks Mishin

The descriptor 'dwfl_fd' is created at nm.c:1278 by calling
function 'dup' and lost at nm.c:1593.

Found by RASU JSC.

Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
---
 src/nm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/nm.c b/src/nm.c
index 3675f59b..fee397dd 100644
--- a/src/nm.c
+++ b/src/nm.c
@@ -1521,6 +1521,8 @@ show_symbols (int fd, Ebl *ebl, GElf_Ehdr *ehdr,
     }
   if (dwfl != NULL)
     dwfl_end (dwfl);
+  if (dwfl_fd != NULL)
+    close(dwfl_fd);
 }
 
 
-- 
2.30.2


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

end of thread, other threads:[~2024-03-28 21:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28 20:49 [PATCH] nm: Fix descriptor leak Maks Mishin
2024-03-28 21:12 ` 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).