Qcow2Cache *qcow2_cache_create(BlockDriverState *bs, int num_tables)

{

    BDRVQcowState *s = bs->opaque;

    Qcow2Cache *c;

    int i;



    c = g_malloc0(sizeof(*c));

    c->size = num_tables;

    c->entries = g_malloc0(sizeof(*c->entries) * num_tables);



    for (i = 0; i < c->size; i++) {

        c->entries[i].table = qemu_try_blockalign(bs->file, s->cluster_size);

        if (c->entries[i].table == NULL) {

            goto fail;

        }

    }



    return c;



fail:

    for (i = 0; i < c->size; i++) {

        qemu_vfree(c->entries[i].table);

    }

    g_free(c->entries);

    g_free(c);

    return NULL;

}

Qcow2Cache *qcow2_cache_create(BlockDriverState *bs, int num_tables)

{

    BDRVQcowState *s = bs->opaque;

    Qcow2Cache *c;

    int i;



    c = g_malloc0(sizeof(*c));

    c->size = num_tables;

    c->entries = g_malloc0(sizeof(*c->entries) * num_tables);



    for (i = 0; i < c->size; i++) {

        c->entries[i].table = qemu_try_blockalign(bs->file, s->cluster_size);

        if (c->entries[i].table == NULL) {

            goto fail;

        }

    }



    return c;



fail:

    for (i = 0; i < c->size; i++) {

        qemu_vfree(c->entries[i].table);

    }

    g_free(c->entries);

    g_free(c);

    return NULL;

}

    c->entries = g_malloc0(sizeof(*c->entries) * num_tables);
Qcow2Cache *FUNC_0(BlockDriverState *bs, int num_tables)

{

    BDRVQcowState *s = bs->opaque;

    Qcow2Cache *c;

    int VAR_0;



    c = g_malloc0(sizeof(*c));

    c->size = num_tables;

    c->entries = g_malloc0(sizeof(*c->entries) * num_tables);



    for (VAR_0 = 0; VAR_0 < c->size; VAR_0++) {

        c->entries[VAR_0].table = qemu_try_blockalign(bs->file, s->cluster_size);

        if (c->entries[VAR_0].table == NULL) {

            goto fail;

        }

    }



    return c;



fail:

    for (VAR_0 = 0; VAR_0 < c->size; VAR_0++) {

        qemu_vfree(c->entries[VAR_0].table);

    }

    g_free(c->entries);

    g_free(c);

    return NULL;

}

Qcow2Cache *FUNC_0(BlockDriverState *bs, int num_tables)
{ BDRVQcowState *s = bs->opaque; Qcow2Cache *c; int VAR_0; c = g_malloc0(sizeof(*c)); c->size = num_tables; c->entries = g_malloc0(sizeof(*c->entries) * num_tables); for (VAR_0 = 0; VAR_0 < c->size; VAR_0++) { c->entries[VAR_0].table = qemu_try_blockalign(bs->file, s->cluster_size); if (c->entries[VAR_0].table == NULL) { goto fail; } } return c; fail:
for (VAR_0 = 0; VAR_0 < c->size; VAR_0++) { qemu_vfree(c->entries[VAR_0].table); } g_free(c->entries); g_free(c); return NULL; }