On Wed, Apr 14, 2010 at 4:50 PM, Kevin Wolf <kw...@redhat.com> wrote: > diff --git a/block/qcow.c b/block/qcow.c > index c619984..01b1692 100644 > --- a/block/qcow.c > +++ b/block/qcow.c [..] > @@ -169,7 +166,7 @@ static int qcow_open(BlockDriverState *bs, const char > *filename, int flags) > qemu_free(s->l2_cache); > qemu_free(s->cluster_cache); > qemu_free(s->cluster_data); > - bdrv_delete(s->hd); > + bdrv_delete(bs->file); > return -1; > }
qcow.c does not need to delete bs->file anymore because block.c does that when BlockDriver->bdrv_open() fails. Also since we're not setting bs->file to NULL after bdrv_delete() here, block.c will double delete it. > @@ -739,7 +737,7 @@ static void qcow_close(BlockDriverState *bs) > qemu_free(s->l2_cache); > qemu_free(s->cluster_cache); > qemu_free(s->cluster_data); > - bdrv_delete(s->hd); > + bdrv_delete(bs->file); > } > > static int qcow_create(const char *filename, QEMUOptionParameter *options) block.c will bdrv_close(bs->file) for us, so I think this is not needed. Double delete. > diff --git a/block/qcow2.c b/block/qcow2.c > index 11ce8d1..4949d77 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c [...] > @@ -254,7 +250,7 @@ static int qcow_open(BlockDriverState *bs, const char > *filename, int flags) > qemu_free(s->l2_cache); > qemu_free(s->cluster_cache); > qemu_free(s->cluster_data); > - bdrv_delete(s->hd); > + bdrv_delete(bs->file); > return -1; > } Same as above. > diff --git a/block/vdi.c b/block/vdi.c > index c91961a..8b85339 100644 > --- a/block/vdi.c > +++ b/block/vdi.c [...] > @@ -452,7 +446,7 @@ static int vdi_open(BlockDriverState *bs, const char > *filename, int flags) > qemu_free(s->bmap); > > fail: > - bdrv_delete(s->hd); > + bdrv_delete(bs->file); > return -1; > } Same as above. > diff --git a/block/vpc.c b/block/vpc.c > index 950ad58..1d1ae09 100644 > --- a/block/vpc.c > +++ b/block/vpc.c [...] > @@ -228,7 +224,7 @@ static int vpc_open(BlockDriverState *bs, const char > *filename, int flags) > > return 0; > fail: > - bdrv_delete(s->hd); > + bdrv_delete(bs->file); > return -1; > } Same as above. > @@ -590,7 +584,7 @@ static void vpc_close(BlockDriverState *bs) > #ifdef CACHE > qemu_free(s->pageentry_u8); > #endif > - bdrv_delete(s->hd); > + bdrv_delete(bs->file); > } > > static QEMUOptionParameter vpc_create_options[] = { Same as above. Stefan