From patchwork Thu Aug 17 22:58:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 22204 Received: (qmail 15074 invoked by alias); 17 Aug 2017 22:58:24 -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 15061 invoked by uid 89); 17 Aug 2017 22:58:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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; Thu, 17 Aug 2017 22:58:22 +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 8E5FB5D5F4 for ; Thu, 17 Aug 2017 22:58:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8E5FB5D5F4 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C2DB60468 for ; Thu, 17 Aug 2017 22:58:20 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] Plug source_command leak Date: Thu, 17 Aug 2017 23:58:20 +0100 Message-Id: <1503010700-25096-1-git-send-email-palves@redhat.com> The heap-allocated 'old_source_verbose' local was accidentally left behind by commit 2ec845e75876 ("More uses of scoped_restore"). Valgrind caught it, like: ==20123== 8 bytes in 1 blocks are definitely lost in loss record 4,609 of 13,785 ==20123== at 0x4C2A988: calloc (vg_replace_malloc.c:711) ==20123== by 0x60A2F8: xcalloc (common-utils.c:84) ==20123== by 0x4CDBE5: build_command_line(command_control_type, char const*) (cli-script.c:159) ==20123== by 0x4CDC32: get_command_line(command_control_type, char const*) (cli-script.c:172) ==20123== by 0x5230F1: python_command(char*, int) (python.c:421) ==20123== by 0x4C61AD: do_cfunc(cmd_list_element*, char*, int) (cli-decode.c:106) ==20123== by 0x4C911F: cmd_func(cmd_list_element*, char*, int) (cli-decode.c:1902) ==20123== by 0x7CA79E: execute_command(char*, int) (top.c:650) ==20123== by 0x695A0C: command_handler(char*) (event-top.c:590) ==20123== by 0x7CA33F: read_command_file(_IO_FILE*) (top.c:461) ==20123== by 0x4D0C3A: script_from_file(_IO_FILE*, char const*) (cli-script.c:1584) ==20123== by 0x4C2727: source_script_from_stream(_IO_FILE*, char const*, char const*) (cli-cmds.c:589) gdb/ChangeLog: 2017-08-17 Pedro Alves * cli/cli-cmds.c (source_command): Delete 'old_source_verbose' local. --- gdb/ChangeLog | 5 +++++ gdb/cli/cli-cmds.c | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 50b7237..083e312 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2017-08-17 Pedro Alves + * cli/cli-cmds.c (source_command): Delete 'old_source_verbose' + local. + +2017-08-17 Pedro Alves + * dwarf2read.c (struct dwarf2_cu) : New field. (reset_die_in_process): Delete, replaced by ... diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index d3ec4ae..3fa2499 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -639,7 +639,6 @@ static void source_command (char *args, int from_tty) { char *file = args; - int *old_source_verbose = XNEW (int); int search_path = 0; scoped_restore save_source_verbose = make_scoped_restore (&source_verbose);