aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blockdev.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/blockdev.c b/blockdev.c
index f6ac4398b8..3b3b82dba7 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -30,14 +30,16 @@ void blockdev_mark_auto_del(BlockDriverState *bs)
{
DriveInfo *dinfo = drive_get_by_blockdev(bs);
- dinfo->auto_del = 1;
+ if (dinfo) {
+ dinfo->auto_del = 1;
+ }
}
void blockdev_auto_del(BlockDriverState *bs)
{
DriveInfo *dinfo = drive_get_by_blockdev(bs);
- if (dinfo->auto_del) {
+ if (dinfo && dinfo->auto_del) {
drive_uninit(dinfo);
}
}