From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NBOye-0001vD-6g for qemu-devel@nongnu.org; Fri, 20 Nov 2009 03:36:24 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NBOyZ-0001uK-3g for qemu-devel@nongnu.org; Fri, 20 Nov 2009 03:36:23 -0500 Received: from [199.232.76.173] (port=56817 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NBOyY-0001uF-U4 for qemu-devel@nongnu.org; Fri, 20 Nov 2009 03:36:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28489) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NBOyY-0001vx-HU for qemu-devel@nongnu.org; Fri, 20 Nov 2009 03:36:18 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAK8aHHe003994 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 20 Nov 2009 03:36:17 -0500 Message-ID: <4B0654BA.10608@redhat.com> Date: Fri, 20 Nov 2009 09:35:06 +0100 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] qemu-io: Fix memory leak References: <1258537379-25369-1-git-send-email-kwolf@redhat.com> <20091120080547.GB4112@amit-x200.redhat.com> In-Reply-To: <20091120080547.GB4112@amit-x200.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: qemu-devel@nongnu.org Am 20.11.2009 09:05, schrieb Amit Shah: > On (Wed) Nov 18 2009 [10:42:59], Kevin Wolf wrote: >> Signed-off-by: Kevin Wolf >> --- >> qemu-io.c | 10 ++++++---- >> 1 files changed, 6 insertions(+), 4 deletions(-) >> >> diff --git a/qemu-io.c b/qemu-io.c >> index cac72e9..c84b361 100644 >> --- a/qemu-io.c >> +++ b/qemu-io.c >> @@ -129,7 +129,8 @@ create_iovec(QEMUIOVector *qiov, char **argv, int nr_iov, int pattern) >> { >> size_t *sizes = calloc(nr_iov, sizeof(size_t)); >> size_t count = 0; >> - void *buf, *p; >> + void *buf = NULL; >> + void *p; >> int i; > > I'd prefer the init to happen after the declarations -- brings in > consistent style, puts declarations in one blob and makes > initialisations explicit. In the context of this function it would be inconsistent, and I'd be surprised if the rest of the qemu code was consistent with your expectations. After all, it's a matter of taste, and in such questions I tend to stick with the style of the surrounding code. Kevin