aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorNicholas A. Bellinger <nab@linux-iscsi.org>2010-05-27 08:56:28 -0700
committerKevin Wolf <kwolf@redhat.com>2010-05-28 13:29:17 +0200
commit1a396859105c4c27fdec08180be26288b8a629a3 (patch)
treeb4a282ee6855bee7fa33d356c1ae42c82eb73233 /block.c
parent86fa8da83771238de55dc44819a1a27bafef5353 (diff)
block: Add missing bdrv_delete() for SG_IO BlockDriver in find_image_format()
This patch adds a missing bdrv_delete() call in find_image_format() so that a SG_IO BlockDriver properly releases the temporary BlockDriverState *bs created from bdrv_file_open() Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org> Reported-by: Chris Krumme <chris.krumme@windriver.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
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 24c63f6338..296de890b6 100644
--- a/block.c
+++ b/block.c
@@ -332,8 +332,10 @@ static BlockDriver *find_image_format(const char *filename)
return NULL;
/* Return the raw BlockDriver * to scsi-generic devices */
- if (bs->sg)
+ if (bs->sg) {
+ bdrv_delete(bs);
return bdrv_find_format("raw");
+ }
ret = bdrv_pread(bs, 0, buf, sizeof(buf));
bdrv_delete(bs);