From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22532 invoked by alias); 24 Jun 2015 21:35:12 -0000 Mailing-List: contact gdb-testers-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-testers-owner@sourceware.org Received: (qmail 22520 invoked by uid 89); 24 Jun 2015 21:35:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: kwanyin.sergiodj.net Received: from kwanyin.sergiodj.net (HELO kwanyin.sergiodj.net) (176.31.208.32) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 24 Jun 2015 21:35:11 +0000 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [binutils-gdb] Fix lrealpath memory leak in build_id_to_debug_bfd From: sergiodj+buildbot@redhat.com To: gdb-testers@sourceware.org Message-Id: <32fad71f9e6cdf73fe3c10123b23f42397b83e7d@kwanyin> Date: Wed, 24 Jun 2015 21:35:00 -0000 X-SW-Source: 2015-q2/txt/msg07358.txt.bz2 *** TEST RESULTS FOR COMMIT 32fad71f9e6cdf73fe3c10123b23f42397b83e7d *** Author: Keith Seitz Branch: master Commit: 32fad71f9e6cdf73fe3c10123b23f42397b83e7d Fix lrealpath memory leak in build_id_to_debug_bfd Valgrind reports memory leaking from build_id_to_debug_bfd: ==7261== 88 bytes in 2 blocks are definitely lost in loss record 31,319 of 35,132 ==7261== at 0x4A06BCF: malloc (vg_replace_malloc.c:296) ==7261== by 0x32CA88A9B9: strdup (strdup.c:42) ==7261== by 0xFE62AB: lrealpath (lrealpath.c:88) ==7261== by 0x7F7AD6: build_id_to_debug_bfd (build-id.c:116) ==7261== by 0x7F7BB5: find_separate_debug_file_by_buildid (build-id.c:149) ==7261== by 0x6D9382: elf_symfile_read (elfread.c:1348) ==7261== by 0x777F02: read_symbols (symfile.c:875) ==7261== by 0x778505: syms_from_objfile_1 (symfile.c:1078) ==7261== by 0x778548: syms_from_objfile (symfile.c:1094) ==7261== by 0x778746: symbol_file_add_with_addrs (symfile.c:1191) ==7261== by 0x77893B: symbol_file_add_from_bfd (symfile.c:1280) ==7261== by 0x8E51E3: solib_read_symbols (solib.c:706) ==7261== by 0x8E58AF: solib_add (solib.c:1029) This occurs because commit 1be5090b in bfd, addressing PR 11983, started taking a copy of the input filename instead of directly caching it. It appears that this code was never updated to reflect that API change. This simple patch creates a cleanup to free the return value for lrealpath. gdb/ChangeLog * build-id.c (build_id_to_debug_bfd): Add cleanup to free return value from lrealpath.