From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1099 invoked by alias); 5 Oct 2010 22:47:25 -0000 Received: (qmail 1088 invoked by uid 22791); 5 Oct 2010 22:47:24 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Oct 2010 22:47:19 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o95MlG1S028848 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Oct 2010 18:47:16 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id o95MlGEa017393; Tue, 5 Oct 2010 18:47:16 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o95MlFD3029644; Tue, 5 Oct 2010 18:47:15 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id E3343379C1A; Tue, 5 Oct 2010 16:47:14 -0600 (MDT) From: Tom Tromey To: Ali Lakhia Cc: gdb-patches@sourceware.org Subject: Re: [patch] Memory leak fixes References: Date: Tue, 05 Oct 2010 22:47:00 -0000 In-Reply-To: (Ali Lakhia's message of "Fri, 1 Oct 2010 17:16:02 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2010-10/txt/msg00062.txt.bz2 >>>>> "Ali" == Ali Lakhia writes: Ali> Please see fixes for memory leaks. My testing for these has been Ali> limited to just making sure things work for my day-to-day use. Thanks, In addition to what Joel said, I have a couple notes on the patch itself.q Ali> diff -ru gdb-7.1/gdb/dwarf2read.c gdb-7.1/gdb/dwarf2read.c Ali> --- gdb-7.1/gdb/dwarf2read.c 2010-09-14 16:59:40.000000000 -0700 Ali> +++ gdb-7.1/gdb/dwarf2read.c 2010-06-15 14:53:54.000000000 -0700 Ali> @@ -5462,6 +5462,7 @@ Ali> set_descriptive_type (type, die, cu); Ali> do_cleanups (back_to); Ali> + xfree (range_types); This one seems to be fixed in CVS. There is a cleanup covering range_types. Actually, I see this cleanup in 7.1 as well. How did you find this leak? Maybe the logic around creating the cleanup is wrong. Ali> diff -ru gdb-7.1/gdb/printcmd.c gdb-7.1/gdb/printcmd.c Ali> --- gdb-7.1/gdb/printcmd.c 2010-09-14 17:03:28.000000000 -0700 Ali> +++ gdb-7.1/gdb/printcmd.c 2010-06-15 14:53:54.000000000 -0700 Ali> @@ -608,6 +608,7 @@ Ali> fputs_filtered (">", stream); Ali> do_cleanups (cleanup_chain); Ali> + xfree (filename); Ali> } This one is also covered by a cleanup. Ali> diff -ru gdb-7.1/gdb/python/py-type.c gdb-7.1/gdb/python/py-type.c Ali> --- gdb-7.1/gdb/python/py-type.c 2010-09-14 17:03:28.000000000 -0700 Ali> +++ gdb-7.1/gdb/python/py-type.c 2010-06-14 14:04:28.000000000 -0700 Ali> @@ -580,6 +580,7 @@ Ali> type_print (type_object_to_type (self), "", stb, -1); Ali> + xfree (thetype); Ali> thetype = ui_file_xstrdup (stb, &length); Ali> do_cleanups (old_chain); I didn't check this one, but if you want to insert a free before a call to do_cleanups, usually that means you should create a cleanup at the point of allocation. Tom