提交 3d34c6cd 编写于 作者: F Fam Zheng 提交者: Stefan Hajnoczi

vvfat: use bdrv_new() to allocate BlockDriverState

we need bdrv_new() to properly initialize BDS, don't allocate memory
manually.
Signed-off-by: NFam Zheng <famz@redhat.com>
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 a94a3fac
...@@ -2943,7 +2943,7 @@ static int enable_write_target(BDRVVVFATState *s) ...@@ -2943,7 +2943,7 @@ static int enable_write_target(BDRVVVFATState *s)
unlink(s->qcow_filename); unlink(s->qcow_filename);
#endif #endif
s->bs->backing_hd = calloc(sizeof(BlockDriverState), 1); s->bs->backing_hd = bdrv_new("");
s->bs->backing_hd->drv = &vvfat_write_target; s->bs->backing_hd->drv = &vvfat_write_target;
s->bs->backing_hd->opaque = g_malloc(sizeof(void*)); s->bs->backing_hd->opaque = g_malloc(sizeof(void*));
*(void**)s->bs->backing_hd->opaque = s; *(void**)s->bs->backing_hd->opaque = s;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册