[PATCH] libdwfl: Don't leak fname if file is main file by another name in try_open.
Mark Wielaard
mjw at redhat.com
Thu Jun 18 14:21:16 UTC 2015
Signed-off-by: Mark Wielaard <mjw at redhat.com>
---
libdwfl/ChangeLog | 4 ++++
libdwfl/find-debuginfo.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index ca98783..5059be6 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,9 @@
2015-06-18 Mark Wielaard <mjw at redhat.com>
+ * find-debuginfo.c (try_open): Free fname on all failure paths.
+
+2015-06-18 Mark Wielaard <mjw at redhat.com>
+
* dwfl_module_getdwarf.c (find_symtab): Check shdr is not NULL and
sh_entsize is not zero.
diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
index c523354..1faa494 100644
--- a/libdwfl/find-debuginfo.c
+++ b/libdwfl/find-debuginfo.c
@@ -1,5 +1,5 @@
/* Standard find_debuginfo callback for libdwfl.
- Copyright (C) 2005-2010, 2014 Red Hat, Inc.
+ Copyright (C) 2005-2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -62,6 +62,7 @@ try_open (const struct stat64 *main_stat,
&& st.st_dev == main_stat->st_dev)
{
/* This is the main file by another name. Don't look at it again. */
+ free (fname);
close (fd);
errno = ENOENT;
fd = -1;
--
1.8.3.1
More information about the elfutils-devel
mailing list