From patchwork Fri Feb 22 15:13:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Benson X-Patchwork-Id: 31555 Received: (qmail 46788 invoked by alias); 22 Feb 2019 15:13:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 46713 invoked by uid 89); 22 Feb 2019 15:13:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1080, RHEL, rhel X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 22 Feb 2019 15:13:19 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 66040309D284 for ; Fri, 22 Feb 2019 15:13:17 +0000 (UTC) Received: from blade.nx (unknown [10.36.118.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F5ED60192 for ; Fri, 22 Feb 2019 15:13:17 +0000 (UTC) Received: from blade.com (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 551F8801ABC4 for ; Fri, 22 Feb 2019 15:13:16 +0000 (GMT) From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH] Fix coff_start_symtab resource leak found by Coverity Date: Fri, 22 Feb 2019 15:13:13 +0000 Message-Id: <1550848393-2743-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes Hi all, This commit fixes a resource leak found by Coverity, where coff_start_symtab performs an xstrdup that is now performed within start_symtab by buildsym_compunit::buildsym_compunit. Built and regtested on RHEL 7.6 x86_64. Ok to commit? Thanks, Gary --- gdb/ChangeLog: * coffread.c (coff_start_symtab): Remove unnecessary xstrdup. --- gdb/ChangeLog | 4 ++++ gdb/coffread.c | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gdb/coffread.c b/gdb/coffread.c index 6381cd3..91a112e 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -385,10 +385,7 @@ coff_start_symtab (struct objfile *objfile, const char *name) { within_function = 0; start_symtab (objfile, - /* We fill in the filename later. start_symtab puts this pointer - into last_source_file and we put it in subfiles->name, which - end_symtab frees; that's why it must be malloc'd. */ - xstrdup (name), + name, /* We never know the directory name for COFF. */ NULL, /* The start address is irrelevant, since we call