diff options
author | Anthony Liguori | 2011-02-16 15:47:13 +0100 |
---|---|---|
committer | Anthony Liguori | 2011-02-16 15:47:13 +0100 |
commit | 79f2b6fcdb7c06cdce6eccc796f5651f3efb843e (patch) | |
tree | fcb22804f1845c77206bbfe6ff2f3470deea014f /blockdev.c | |
parent | Merge remote branch 'qemu-kvm/uq/master' into staging (diff) | |
parent | qcow2: Fix order in L2 table COW (diff) | |
download | qemu-79f2b6fcdb7c06cdce6eccc796f5651f3efb843e.tar.gz qemu-79f2b6fcdb7c06cdce6eccc796f5651f3efb843e.tar.xz qemu-79f2b6fcdb7c06cdce6eccc796f5651f3efb843e.zip |
Merge remote branch 'kwolf/for-anthony' into staging
Diffstat (limited to 'blockdev.c')
-rw-r--r-- | blockdev.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/blockdev.c b/blockdev.c index ecfadc138f..0690cc8bea 100644 --- a/blockdev.c +++ b/blockdev.c @@ -182,6 +182,7 @@ static void drive_uninit(DriveInfo *dinfo) { qemu_opts_del(dinfo->opts); bdrv_delete(dinfo->bdrv); + qemu_free(dinfo->id); QTAILQ_REMOVE(&drives, dinfo, next); qemu_free(dinfo); } @@ -525,7 +526,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) } else if (ro == 1) { if (type != IF_SCSI && type != IF_VIRTIO && type != IF_FLOPPY && type != IF_NONE) { error_report("readonly not supported by this bus type"); - return NULL; + goto err; } } @@ -535,12 +536,19 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) if (ret < 0) { error_report("could not open disk image %s: %s", file, strerror(-ret)); - return NULL; + goto err; } if (bdrv_key_required(dinfo->bdrv)) autostart = 0; return dinfo; + +err: + bdrv_delete(dinfo->bdrv); + qemu_free(dinfo->id); + QTAILQ_REMOVE(&drives, dinfo, next); + qemu_free(dinfo); + return NULL; } void do_commit(Monitor *mon, const QDict *qdict) |