]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl/
authorRoland McGrath <roland@redhat.com>
Sun, 6 Apr 2008 01:57:32 +0000 (01:57 +0000)
committerRoland McGrath <roland@redhat.com>
Sun, 6 Apr 2008 01:57:32 +0000 (01:57 +0000)
* linux-proc-maps.c (proc_maps_report): Don't leak LAST_FILE.

libdwfl/ChangeLog
libdwfl/dwfl_module_getdwarf.c
libdwfl/dwfl_module_report_build_id.c
libdwfl/linux-proc-maps.c

index 265720ae37c23b11763932434d24283417827d4c..734571ca3c5f2e5c2453d8dfaf3f7b484936c4d6 100644 (file)
@@ -1,3 +1,11 @@
+2008-04-05  Roland McGrath  <roland@redhat.com>
+
+       * linux-proc-maps.c (proc_maps_report): Don't leak LAST_FILE.
+
+       * dwfl_module_getdwarf.c (find_file): Always free build_id_bits.
+       Clear it after freeing.
+       * dwfl_module_report_build_id.c (dwfl_module_report_build_id): Likewise.
+
 2008-03-26  Roland McGrath  <roland@redhat.com>
 
        * dwfl_module_getdwarf.c (load_symtab): Don't return success for
index 38bffe589c1a6b1ae7a8c478b117ca7d2e4b5759..bc20d94f4ed1b18078316f54756f17a17e3252bd 100644 (file)
@@ -123,8 +123,8 @@ find_file (Dwfl_Module *mod)
     {
       /* Clear any explicitly reported build ID, just in case it was wrong.
         We'll fetch it from the file when asked.  */
-      if (mod->build_id_len > 0)
-       free (mod->build_id_bits);
+      free (mod->build_id_bits);
+      mod->build_id_bits = NULL;
       mod->build_id_len = 0;
     }
 }
index 4886931b82d141541fa831fbb252ece23d564166..9a1b14f792b34ba63432852598000322299ba13c 100644 (file)
@@ -1,5 +1,5 @@
 /* Report build ID information for a module.
-   Copyright (C) 2007 Red Hat, Inc.
+   Copyright (C) 2007, 2008 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -90,8 +90,7 @@ dwfl_module_report_build_id (Dwfl_Module *mod,
       memcpy (copy, bits, len);
     }
 
-  if (mod->build_id_len > 0)
-    free (mod->build_id_bits);
+  free (mod->build_id_bits);
 
   mod->build_id_bits = copy;
   mod->build_id_len = len;
index 6eaed39ad0597cbcb796b2aec7c04a1d3851f2b8..b4bb6cfc30c98d90a16c991b6404397e74a8ddc8 100644 (file)
@@ -1,5 +1,5 @@
 /* Standard libdwfl callbacks for debugging a live Linux process.
-   Copyright (C) 2005, 2007 Red Hat, Inc.
+   Copyright (C) 2005, 2007, 2008 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -138,12 +138,12 @@ proc_maps_report (Dwfl *dwfl, FILE *f, GElf_Addr sysinfo_ehdr, pid_t pid)
     {
       if (last_file != NULL)
        {
-         if (INTUSE(dwfl_report_module) (dwfl, last_file, low, high) == NULL)
-           {
-             free (last_file);
-             return true;
-           }
+         Dwfl_Module *mod = INTUSE(dwfl_report_module) (dwfl, last_file,
+                                                        low, high);
+         free (last_file);
          last_file = NULL;
+         if (unlikely (mod == NULL))
+           return true;
        }
       return false;
     }