[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 5/5] Change order of metadata update to prevent
From: |
Gleb Natapov |
Subject: |
Re: [Qemu-devel] [PATCH 5/5] Change order of metadata update to prevent loosing guest data because of unexpected exit. |
Date: |
Mon, 24 Nov 2008 22:19:42 +0200 |
On Mon, Nov 24, 2008 at 10:49:46AM -0600, Anthony Liguori wrote:
>> diff --git a/block-qcow2.c b/block-qcow2.c
>> index 0771281..c600517 100644
>> --- a/block-qcow2.c
>> +++ b/block-qcow2.c
>> @@ -852,6 +852,69 @@ static uint64_t
>> alloc_compressed_cluster_offset(BlockDriverState *bs,
>> return cluster_offset;
>> }
>> +typedef struct QCowL2Meta
>> +{
>> + uint64_t offset;
>> + int n_start;
>> + int nb_available;
>> + int nb_clusters;
>> +} QCowL2Meta;
>> +
>> +static int alloc_cluster_link_l2(BlockDriverState *bs, uint64_t
>> cluster_offset,
>> + QCowL2Meta *m)
>> +{
>> + BDRVQcowState *s = bs->opaque;
>> + int i, j = 0, l2_index, ret;
>> + uint64_t *old_cluster, start_sect, l2_offset, *l2_table;
>> +
>> + if (m->nb_clusters == 0)
>> + return 0;
>> +
>> + if (!(old_cluster = qemu_malloc(m->nb_clusters * sizeof(uint64_t))))
>> + return -ENOMEM;
>>
>
> This memory is never freed.
>
I swear there was free() there! Well, it probably fell a victim to one of
the rewrites :)
--
Gleb.
- [Qemu-devel] [PATCH 2/5] Introduce new helper function qcow_shedule_bh()., (continued)