diff options
author | Kevin Wolf <kwolf@redhat.com> | 2011-10-26 11:03:01 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-10-28 19:25:49 +0200 |
commit | 2b5728164fcf5211bbae8d3c2fc6df62dd6b2295 (patch) | |
tree | 3d576758db3300e4519aa41a524ccd26b1ae1799 | |
parent | 3574c608195c10f4ac48bb6a27d1c5e2c5f9ac3a (diff) |
block: Fix bdrv_open use after free
tmp_filename was used outside the block it was defined in, i.e. after it went
out of scope. Move its declaration to the top level.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r-- | block.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -571,6 +571,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, BlockDriver *drv) { int ret; + char tmp_filename[PATH_MAX]; if (flags & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; @@ -578,7 +579,6 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, int is_protocol = 0; BlockDriver *bdrv_qcow2; QEMUOptionParameter *options; - char tmp_filename[PATH_MAX]; char backing_filename[PATH_MAX]; /* if snapshot, we create a temporary backing file and open it |