From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20288 invoked by alias); 11 Jan 2012 00:31:03 -0000 Received: (qmail 20262 invoked by uid 22791); 11 Jan 2012 00:30:58 -0000 X-SWARE-Spam-Status: No, hits=-6.6 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; Wed, 11 Jan 2012 00:30:43 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0B0UfA5003645 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 10 Jan 2012 19:30:42 -0500 Received: from host2.jankratochvil.net (ovpn-116-21.ams2.redhat.com [10.36.116.21]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q0B0UaGD028106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 10 Jan 2012 19:30:40 -0500 Date: Wed, 11 Jan 2012 00:31:00 -0000 From: Jan Kratochvil To: Khoo Yit Phang Cc: gdb@sourceware.org Subject: Re: xfree/make_cleanup memory leak pattern? Message-ID: <20120111003035.GA11850@host2.jankratochvil.net> References: <197CEDA3-0851-4FD2-B821-FD800C991F2D@cs.umd.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <197CEDA3-0851-4FD2-B821-FD800C991F2D@cs.umd.edu> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-01/txt/msg00035.txt.bz2 On Wed, 11 Jan 2012 01:25:06 +0100, Khoo Yit Phang wrote: > I noticed the following code pattern in various places in GDB: > script = compute_python_string (cmd->body_list[0]); > ... > xfree (script); > > and also others like: > full_path = tilde_expand (filename); > ... > cleanup = make_cleanup (xfree, full_path); immediate_quit will cause: fatal ("Quit"); which calls throw_exception in the end so all the intermediate cleanup functions get called. You can trace/debug it yourself. I do not see a leak there. Could you provide some debugging output proving the memory is being leaked? Thanks, Jan