qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/6] qcow2: don't leak buffer for unexpected qco


From: Jim Meyering
Subject: Re: [Qemu-devel] [PATCH 1/6] qcow2: don't leak buffer for unexpected qcow_version in header
Date: Mon, 21 May 2012 13:07:12 +0200

Kevin Wolf wrote:
> Am 16.05.2012 15:07, schrieb Jim Meyering:
>> From: Jim Meyering <address@hidden>
>>
>>
>> Signed-off-by: Jim Meyering <address@hidden>
>> ---
>>  block/qcow2.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/block/qcow2.c b/block/qcow2.c
>> index 655799c..f3388bf 100644
>> --- a/block/qcow2.c
>> +++ b/block/qcow2.c
>> @@ -919,6 +919,7 @@ int qcow2_update_header(BlockDriverState *bs)
>>          ret = sizeof(*header);
>>          break;
>>      default:
>> +        free(buf);
>>          return -EINVAL;
>>      }
>>
>
> buf was allocated with qemu_blockalign(), so it must be freed with
> qemu_vfree(). But instead of open-coding it here, this place should work
> like all other places in the same function:
>
> ret = -EINVAL;
> goto fail;

Hi Kevin,
Thanks.  That is obviously better.
I've just posted a v2.



reply via email to

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