From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:52511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJ2ai-0007qn-HO for qemu-devel@nongnu.org; Wed, 26 Oct 2011 08:28:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RJ2ah-0008AW-75 for qemu-devel@nongnu.org; Wed, 26 Oct 2011 08:28:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJ2ah-0008AD-01 for qemu-devel@nongnu.org; Wed, 26 Oct 2011 08:28:19 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9QCSI6J022712 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 26 Oct 2011 08:28:18 -0400 From: Kevin Wolf Date: Wed, 26 Oct 2011 14:31:17 +0200 Message-Id: <1319632282-22725-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1319632282-22725-1-git-send-email-kwolf@redhat.com> References: <1319632282-22725-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 2/7] block: Fix bdrv_open use after free List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com 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 --- block.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block.c b/block.c index 86d450c..9dbb572 100644 --- a/block.c +++ b/block.c @@ -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 -- 1.7.6.4