From: Mark Wielaard Date: Wed, 5 Jun 2013 15:03:25 +0000 (+0200) Subject: libdwfl: link_map.c (report_r_debug) always release memory_callback buffer. X-Git-Tag: elfutils-0.156~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=24b26ec1aaf4dc87d274f1786a1ad83b3ec2ba25;p=thirdparty%2Felfutils.git libdwfl: link_map.c (report_r_debug) always release memory_callback buffer. 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 --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 9ee0ab16d..e0004130a 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2013-06-05 Mark Wielaard + + * link_map.c (report_r_debug): Always call release_buffer after + memory_callback succeeded reading build_id. + 2013-05-30 Jan Kratochvil * argp-std.c (parse_opt) core> e>: Set diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c index e752a5dbf..fecf616d2 100644 --- a/libdwfl/link_map.c +++ b/libdwfl/link_map.c @@ -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); } }