From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18768 invoked by alias); 27 Feb 2011 21:57:16 -0000 Received: (qmail 18760 invoked by uid 22791); 27 Feb 2011 21:57:15 -0000 X-SWARE-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,TW_RG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 27 Feb 2011 21:57:11 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 30CAD13028; Sun, 27 Feb 2011 13:57:10 -0800 (PST) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost3.vmware.com (Postfix) with ESMTP id 25CFECD94A; Sun, 27 Feb 2011 13:57:10 -0800 (PST) Message-ID: <4D6AC8B5.4030702@vmware.com> Date: Sun, 27 Feb 2011 22:00:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.24 (X11/20101201) MIME-Version: 1.0 To: Jan Kratochvil CC: "gdb-patches@sourceware.org" Subject: Re: [rfa] add_symbol_file_command, avoid memory leak. References: <4D69AAFC.6030607@vmware.com> <20110227171301.GA16297@host1.dyn.jankratochvil.net> <4D6AB5A2.3030807@vmware.com> <20110227204206.GA11932@host1.dyn.jankratochvil.net> In-Reply-To: <20110227204206.GA11932@host1.dyn.jankratochvil.net> Content-Type: multipart/mixed; boundary="------------040805080000080008020106" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00853.txt.bz2 This is a multi-part message in MIME format. --------------040805080000080008020106 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 737 Jan Kratochvil wrote: > On Sun, 27 Feb 2011 21:35:46 +0100, Michael Snyder wrote: >> Jan Kratochvil wrote: >>> While a nitpick it is a regression, that dont_repeat should be called even >>> in the case of that error. >> No, it's a fix. I moved the error before dont_repeat. > > Why? The manual says: > `add-symbol-file' does not repeat if you press after using it. > Other part of the manual says: > and you can repeat certain GDB commands by typing just . > > There is nothing said that whether the command is / is not repated depends on > its entered arguments. > > (Not sure if it matters to continue the discussion, I do not mind either way.) Ah, sorry, I misunderstood you. I'm with you now. How about this? --------------040805080000080008020106 Content-Type: text/plain; name="symfile2.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="symfile2.txt" Content-length: 968 2011-02-26 Michael Snyder * symfile.c (add_symbol_file_command): Avoid memory leak. Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.307 diff -u -p -u -p -r1.307 symfile.c --- symfile.c 26 Feb 2011 02:07:09 -0000 1.307 +++ symfile.c 27 Feb 2011 21:56:20 -0000 @@ -2169,15 +2169,15 @@ add_symbol_file_command (char *args, int size_t num_sect_opts = 0; struct cleanup *my_cleanups = make_cleanup (null_cleanup, NULL); - num_sect_opts = 16; - sect_opts = (struct sect_opt *) xmalloc (num_sect_opts - * sizeof (struct sect_opt)); - dont_repeat (); if (args == NULL) error (_("add-symbol-file takes a file name and an address")); + num_sect_opts = 16; + sect_opts = (struct sect_opt *) xmalloc (num_sect_opts + * sizeof (struct sect_opt)); + argv = gdb_buildargv (args); make_cleanup_freeargv (argv); --------------040805080000080008020106--