s->cluster_cache = g_malloc(s->cluster_size);
/* one more sector for decompressed data alignment */
- s->cluster_data = g_malloc(QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size
+ s->cluster_data = qemu_blockalign(bs, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size
+ 512);
s->cluster_cache_offset = -1;
qcow2_cache_destroy(bs, s->l2_table_cache);
}
g_free(s->cluster_cache);
- g_free(s->cluster_data);
+ qemu_vfree(s->cluster_data);
return ret;
}
*/
if (!cluster_data) {
cluster_data =
- g_malloc0(QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size);
+ qemu_blockalign(bs, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size);
}
assert(cur_nr_sectors <=
qemu_co_mutex_unlock(&s->lock);
qemu_iovec_destroy(&hd_qiov);
- g_free(cluster_data);
+ qemu_vfree(cluster_data);
return ret;
}
if (s->crypt_method) {
if (!cluster_data) {
- cluster_data = g_malloc0(QCOW_MAX_CRYPT_CLUSTERS *
+ cluster_data = qemu_blockalign(bs, QCOW_MAX_CRYPT_CLUSTERS *
s->cluster_size);
}
qemu_co_mutex_unlock(&s->lock);
qemu_iovec_destroy(&hd_qiov);
- g_free(cluster_data);
+ qemu_vfree(cluster_data);
return ret;
}
qcow2_cache_destroy(bs, s->refcount_block_cache);
g_free(s->cluster_cache);
- g_free(s->cluster_data);
+ qemu_vfree(s->cluster_data);
qcow2_refcount_close(bs);
}