static void qcow2_close(BlockDriverState *bs)

{

    BDRVQcowState *s = bs->opaque;

    g_free(s->l1_table);

    /* else pre-write overlap checks in cache_destroy may crash */

    s->l1_table = NULL;



    if (!(bs->open_flags & BDRV_O_INCOMING)) {

        qcow2_cache_flush(bs, s->l2_table_cache);

        qcow2_cache_flush(bs, s->refcount_block_cache);



        qcow2_mark_clean(bs);

    }



    qcow2_cache_destroy(bs, s->l2_table_cache);

    qcow2_cache_destroy(bs, s->refcount_block_cache);



    g_free(s->unknown_header_fields);

    cleanup_unknown_header_ext(bs);



    g_free(s->cluster_cache);

    qemu_vfree(s->cluster_data);

    qcow2_refcount_close(bs);

    qcow2_free_snapshots(bs);

}

static void qcow2_close(BlockDriverState *bs)

{

    BDRVQcowState *s = bs->opaque;

    g_free(s->l1_table);

    

    s->l1_table = NULL;



    if (!(bs->open_flags & BDRV_O_INCOMING)) {

        qcow2_cache_flush(bs, s->l2_table_cache);

        qcow2_cache_flush(bs, s->refcount_block_cache);



        qcow2_mark_clean(bs);

    }



    qcow2_cache_destroy(bs, s->l2_table_cache);

    qcow2_cache_destroy(bs, s->refcount_block_cache);



    g_free(s->unknown_header_fields);

    cleanup_unknown_header_ext(bs);



    g_free(s->cluster_cache);

    qemu_vfree(s->cluster_data);

    qcow2_refcount_close(bs);

    qcow2_free_snapshots(bs);

}

    g_free(s->l1_table);     g_free(s->l1_table);     g_free(s->l1_table);     g_free(s->l1_table);
static void FUNC_0(BlockDriverState *VAR_0)

{

    BDRVQcowState *s = VAR_0->opaque;

    g_free(s->l1_table);

    

    s->l1_table = NULL;



    if (!(VAR_0->open_flags & BDRV_O_INCOMING)) {

        qcow2_cache_flush(VAR_0, s->l2_table_cache);

        qcow2_cache_flush(VAR_0, s->refcount_block_cache);



        qcow2_mark_clean(VAR_0);

    }



    qcow2_cache_destroy(VAR_0, s->l2_table_cache);

    qcow2_cache_destroy(VAR_0, s->refcount_block_cache);



    g_free(s->unknown_header_fields);

    cleanup_unknown_header_ext(VAR_0);



    g_free(s->cluster_cache);

    qemu_vfree(s->cluster_data);

    qcow2_refcount_close(VAR_0);

    qcow2_free_snapshots(VAR_0);

}

static void FUNC_0(BlockDriverState *VAR_0)
{ BDRVQcowState *s = VAR_0->opaque; g_free(s->l1_table); s->l1_table = NULL; if (!(VAR_0->open_flags & BDRV_O_INCOMING)) { qcow2_cache_flush(VAR_0, s->l2_table_cache); qcow2_cache_flush(VAR_0, s->refcount_block_cache); qcow2_mark_clean(VAR_0); } qcow2_cache_destroy(VAR_0, s->l2_table_cache); qcow2_cache_destroy(VAR_0, s->refcount_block_cache); g_free(s->unknown_header_fields); cleanup_unknown_header_ext(VAR_0); g_free(s->cluster_cache); qemu_vfree(s->cluster_data); qcow2_refcount_close(VAR_0); qcow2_free_snapshots(VAR_0); }