From patchwork Mon Jun 24 18:48:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33354 Received: (qmail 60802 invoked by alias); 24 Jun 2019 18:49:01 -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 60669 invoked by uid 89); 24 Jun 2019 18:49:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1548 X-HELO: gateway34.websitewelcome.com Received: from gateway34.websitewelcome.com (HELO gateway34.websitewelcome.com) (192.185.148.142) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Jun 2019 18:48:56 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway34.websitewelcome.com (Postfix) with ESMTP id A84E01A2310 for ; Mon, 24 Jun 2019 13:48:55 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fU1Ph9htNdnCefU1PhjhTJ; Mon, 24 Jun 2019 13:48:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=emKpnufevF9rDkM8ROgkEwHtv2lSDsHUekfGmSY0/z4=; b=fkSXErNiwyuPUKOsRnGTqNs5VC VwSoWyHG0J7EFdbXC4szAB6ogmiGCTZ3kFrSKDqreMj6yVZfWU6O6pqpVkbGPXkJNjn+Ofcl30/Ih bgPu3IN3HZpY23M6D/3QiLEPJ; Received: from 75-166-12-78.hlrn.qwest.net ([75.166.12.78]:56746 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1hfU1P-003qDK-ED; Mon, 24 Jun 2019 13:48:55 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 63/66] Remove NULL checks before xfree Date: Mon, 24 Jun 2019 12:48:38 -0600 Message-Id: <20190624184841.3492-14-tom@tromey.com> In-Reply-To: <20190624184841.3492-1-tom@tromey.com> References: <20190623224329.16060-1-tom@tromey.com> <20190624184841.3492-1-tom@tromey.com> A couple of spots in the TUI did a NULL check before an xfree. This isn't necessary, and most other cases were removed from gdb a while ago. 2019-06-23 Tom Tromey * tui/tui-source.c (tui_set_source_content): Don't check before xfree. * tui/tui-disasm.c (tui_disassemble): Don't check before xfree. --- gdb/ChangeLog | 6 ++++++ gdb/tui/tui-disasm.c | 6 ++---- gdb/tui/tui-source.c | 3 +-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index d3d53d7c607..4899b1d03cf 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -59,10 +59,8 @@ tui_disassemble (struct gdbarch *gdbarch, struct tui_asm_line *asm_lines, /* Now construct each line. */ for (; count > 0; count--, asm_lines++) { - if (asm_lines->addr_string) - xfree (asm_lines->addr_string); - if (asm_lines->insn) - xfree (asm_lines->insn); + xfree (asm_lines->addr_string); + xfree (asm_lines->insn); print_address (gdbarch, pc, &gdb_dis_out); asm_lines->addr = pc; diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 4f82cbab2db..889b9509fec 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -163,8 +163,7 @@ tui_set_source_content (struct symtab *s, = (struct tui_source_window_base *) TUI_SRC_WIN; const char *s_filename = symtab_to_filename_for_display (s); - if (TUI_SRC_WIN->title) - xfree (TUI_SRC_WIN->title); + xfree (TUI_SRC_WIN->title); TUI_SRC_WIN->title = xstrdup (s_filename); xfree (src->fullname);