Calling fclose only on bad_report, but not on other errors or success
is confusing. The caller is always responsible for calling fclose on
the given file. Otherwise flcose might be called twice (e.g. in
dwfl_linux_proc_report).

Signed-off-by: Mark Wielaard <[email protected]>
---
 libdwfl/ChangeLog         |    5 +++++
 libdwfl/linux-proc-maps.c |    1 -
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index df7a50f..d325475 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,10 @@
 2013-09-12  Mark Wielaard  <[email protected]>
 
+       * linux-proc-maps.c (proc_maps_report): Don't fclose FILE in
+       bad_report.
+
+2013-09-12  Mark Wielaard  <[email protected]>
+
        * dwfl_module_getdwarf.c (find_symtab): Call elf_getdata with
        aux_xndxscn, not xndxscn, for aux_symxndxdata.
 
diff --git a/libdwfl/linux-proc-maps.c b/libdwfl/linux-proc-maps.c
index 67ff509..10946b9 100644
--- a/libdwfl/linux-proc-maps.c
+++ b/libdwfl/linux-proc-maps.c
@@ -221,7 +221,6 @@ proc_maps_report (Dwfl *dwfl, FILE *f, GElf_Addr 
sysinfo_ehdr, pid_t pid)
            {
            bad_report:
              free (line);
-             fclose (f);
              return -1;
            }
 
-- 
1.7.1

Reply via email to