aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
Diffstat (limited to 'block.c')
-rw-r--r--block.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block.c b/block.c
index 39f373e035..9694018a68 100644
--- a/block.c
+++ b/block.c
@@ -3349,7 +3349,9 @@ static void bdrv_close(BlockDriverState *bs)
bdrv_drain(bs); /* in case flush left pending I/O */
if (bs->drv) {
- bs->drv->bdrv_close(bs);
+ if (bs->drv->bdrv_close) {
+ bs->drv->bdrv_close(bs);
+ }
bs->drv = NULL;
}