From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14987 invoked by alias); 30 Mar 2010 10:44:35 -0000 Received: (qmail 14958 invoked by uid 22791); 30 Mar 2010 10:44:34 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 30 Mar 2010 10:44:29 +0000 Received: (qmail 27834 invoked from network); 30 Mar 2010 10:44:27 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 30 Mar 2010 10:44:27 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: Fix for PR 10736 Date: Tue, 30 Mar 2010 10:44:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.31-20-generic; KDE/4.3.2; x86_64; ; ) Cc: Sergio Durigan Junior References: <201003292101.48377.sergiodj@redhat.com> In-Reply-To: <201003292101.48377.sergiodj@redhat.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201003301144.25720.pedro@codesourcery.com> 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: 2010-03/txt/msg01040.txt.bz2 On Tuesday 30 March 2010 01:01:47, Sergio Durigan Junior wrote: > Hello guys, > > The following patch is a fix for PR 10736. Thanks! > OK? Almost. There's just a leak to fix. > + /* Should we re-read the XML info for this target? */ > + if (my_gdb_datadir && strcmp (my_gdb_datadir, gdb_datadir) != 0) > + { > + /* The data-directory changed from the last time we used it. > + It means that we have to re-read the XML info. */ > + have_initialized_sysinfo = 0; > + xfree (my_gdb_datadir); > + my_gdb_datadir = NULL; The previous data dir is only released if the datadir changed. > + if (sysinfo) > + free_syscalls_info ((void *) sysinfo); > + } > + > + /* Saving the data-directory used to read this XML info. */ > + my_gdb_datadir = xstrdup (gdb_datadir); So here my_gdb_datadir leaks if the datadir _doesn't_ change. I think you just need to move the xfree and my_data_dir=NULL statements outside the `if', before the early return. Anyway, okay with this leak fixed. -- Pedro Alves