Revision 5d757b56 block/qcow2-snapshot.c

b/block/qcow2-snapshot.c
139 139

  
140 140
    snapshots_offset = qcow2_alloc_clusters(bs, snapshots_size);
141 141
    offset = snapshots_offset;
142
    if (offset < 0) {
143
        return offset;
144
    }
142 145

  
143 146
    for(i = 0; i < s->nb_snapshots; i++) {
144 147
        sn = s->snapshots + i;
......
235 238
    QCowSnapshot *snapshots1, sn1, *sn = &sn1;
236 239
    int i, ret;
237 240
    uint64_t *l1_table = NULL;
241
    int64_t l1_table_offset;
238 242

  
239 243
    memset(sn, 0, sizeof(*sn));
240 244

  
......
263 267
        goto fail;
264 268

  
265 269
    /* create the L1 table of the snapshot */
266
    sn->l1_table_offset = qcow2_alloc_clusters(bs, s->l1_size * sizeof(uint64_t));
270
    l1_table_offset = qcow2_alloc_clusters(bs, s->l1_size * sizeof(uint64_t));
271
    if (l1_table_offset < 0) {
272
        goto fail;
273
    }
274

  
275
    sn->l1_table_offset = l1_table_offset;
267 276
    sn->l1_size = s->l1_size;
268 277

  
269 278
    if (s->l1_size != 0) {

Also available in: Unified diff