From 9562f69cfdc55c7c1625bb88df1637fed182e68b Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Sat, 15 Feb 2014 18:03:21 +0100 Subject: [PATCH] block: Unlink temporary file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the image file cannot be opened and was created as a temporary file, it should be deleted; thus, in this case, we should jump to the "unlink_and_fail" label and not just to "fail". Reported-by: BenoƮt Canet Signed-off-by: Max Reitz Acked-by: Stefan Hajnoczi Signed-off-by: Stefan Hajnoczi --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.c b/block.c index cf5645a14a..fae50c95b5 100644 --- a/block.c +++ b/block.c @@ -1321,7 +1321,7 @@ int bdrv_open(BlockDriverState **pbs, const char *filename, bdrv_open_flags(bs, flags | BDRV_O_UNMAP) | BDRV_O_PROTOCOL, true, &local_err); if (ret < 0) { - goto fail; + goto unlink_and_fail; } /* Find the right image format driver */