From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4958 invoked by alias); 8 Mar 2011 04:58:45 -0000 Received: (qmail 4949 invoked by uid 22791); 8 Mar 2011 04:58:45 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Mar 2011 04:58:41 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A90392BAFA9; Mon, 7 Mar 2011 23:58:39 -0500 (EST) 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 4+grQFu0pBIs; Mon, 7 Mar 2011 23:58:39 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id E6B642BAFA5; Mon, 7 Mar 2011 23:58:38 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id ECA821459AD; Tue, 8 Mar 2011 08:58:14 +0400 (RET) Date: Tue, 08 Mar 2011 05:13:00 -0000 From: Joel Brobecker To: Michael Snyder Cc: "gdb-patches@sourceware.org" Subject: Re: [RFA] target.c/read_whatever_is_readable: fix memory leak Message-ID: <20110308045814.GK30306@adacore.com> References: <4D6ADE45.5040705@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D6ADE45.5040705@vmware.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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-03/txt/msg00517.txt.bz2 > 2011-02-27 Michael Snyder > > * target.c (read_whatever_is_readable): Fix memory leak. Looks correct to me. > { > - gdb_byte *buf = xmalloc (end-begin); > + gdb_byte *buf = xmalloc (end - begin); I applied this change myself (as well as a couple of other reformatting changes), mostly because I have a fairly strong preference over separating this type of change (reformatting - no code change) from code changes. It simplifies our task if/when a revert is needed. With git, there is a neat way to commit those changes separately from your other changes: It's "git add -p" - it then asks you hunk by hunk whether to put the change in the index or not (and you and further divide hunks if necessary). Really useful in this sort of situation. -- Joel