sim-card
/
qemu
Archived
10
0
Fork 0

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>
This commit is contained in:
Nicholas A. Bellinger 2010-05-27 08:56:28 -07:00 committed by Kevin Wolf
parent 86fa8da837
commit 1a39685910
1 changed files with 3 additions and 1 deletions

View File

@ -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);