]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl: link_map.c (report_r_debug) always release memory_callback buffer.
authorMark Wielaard <mjw@redhat.com>
Wed, 5 Jun 2013 15:03:25 +0000 (17:03 +0200)
committerMark Wielaard <mjw@redhat.com>
Wed, 5 Jun 2013 20:52:39 +0000 (22:52 +0200)
If the buffer isn't released after getting a valid build-id from the
memory_callback the first run-unstrip-n.sh testcase will fail on systems
where there is a matching librt.so file for which dwfl_addrsegment returns
a valid segment index in the Dwfl (but where the build-id doesn't match).

Signed-off-by: Mark Wielaard <mjw@redhat.com>
libdwfl/ChangeLog
libdwfl/link_map.c

index 9ee0ab16d7cf93619f86e2539541752a7a1cba55..e0004130ac10c78a615a3f3b441927677b3f81f1 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-05  Mark Wielaard  <mjw@redhat.com>
+
+       * link_map.c (report_r_debug): Always call release_buffer after
+       memory_callback succeeded reading build_id.
+
 2013-05-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * argp-std.c (parse_opt) <ARGP_KEY_SUCCESS> <opt->core> <opt->e>: Set
index e752a5dbf7afb801d513bdb019119e83660492d4..fecf616d2c5dc84cdc4be84d0ec1b4522d75fb45 100644 (file)
@@ -395,12 +395,17 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata,
                      if (! (*memory_callback) (dwfl, segndx,
                                                &buffer, &buffer_available,
                                                build_id_vaddr, build_id_len,
-                                               memory_callback_arg)
-                         || memcmp (build_id_bits, buffer, build_id_len) != 0)
+                                               memory_callback_arg))
+                       /* File has valid build-id which cannot be verified
+                          in memory.  */
+                       valid = false;
+                     else
                        {
-                         /* File has valid build-id which cannot be verified
-                            in memory.  */
-                         valid = false;
+                         if (memcmp (build_id_bits, buffer, build_id_len) != 0)
+                           /* File has valid build-id which does not match
+                              the one in memory.  */
+                           valid = false;
+                         release_buffer (0);
                        }
                    }