From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23045 invoked by alias); 25 Jun 2008 12:43:24 -0000 Received: (qmail 23031 invoked by uid 22791); 25 Jun 2008 12:43:24 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 25 Jun 2008 12:43:06 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 909F62A9675; Wed, 25 Jun 2008 08:43:04 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id uECnXpfWMtJZ; Wed, 25 Jun 2008 08:43:04 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id ACC262A964E; Wed, 25 Jun 2008 08:43:03 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 6C389E7ACD; Wed, 25 Jun 2008 08:43:03 -0400 (EDT) Date: Wed, 25 Jun 2008 13:11:00 -0000 From: Joel Brobecker To: teawater Cc: gdb-patches@sourceware.org Subject: Re: [patch]: Fix memory leak of c-exp.y Message-ID: <20080625124303.GB3700@adacore.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i 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: 2008-06/txt/msg00425.txt.bz2 Hi teawater, > 2008-06-21 Hui Zhu > * gdb/c-exp.y: Fix memory leak of function parse_number Instead of adding calls to free, I looks like this string is actually completely local, so how about replacing the call to malloc with a call to alloca, and then get rid of all calls to free instead? -- Joel