qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qemu-io: Fix memory leak


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH] qemu-io: Fix memory leak
Date: Fri, 20 Nov 2009 09:35:06 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4

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 <address@hidden>
>> ---
>>  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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]