From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBo3J-0004HF-Rv for qemu-devel@nongnu.org; Fri, 07 Feb 2014 11:13:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WBo3D-0003XR-P1 for qemu-devel@nongnu.org; Fri, 07 Feb 2014 11:13:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBo3D-0003XD-Gz for qemu-devel@nongnu.org; Fri, 07 Feb 2014 11:13:11 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s17GD6oa016658 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 7 Feb 2014 11:13:10 -0500 From: Kevin Wolf Date: Fri, 7 Feb 2014 17:12:56 +0100 Message-Id: <1391789578-19601-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1391789578-19601-1-git-send-email-kwolf@redhat.com> References: <1391789578-19601-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 1/3] block: Fix memory leaks in bdrv_co_do_pwritev() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, lersek@redhat.com, stefanha@redhat.com The error path for a failure in one of the two bdrv_aligned_preadv() calls leaked head_buf or tail_buf, respectively. This fixes the memory leak. Reported-by: Laszlo Ersek Signed-off-by: Kevin Wolf --- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index ac0ccac..c1d1f74 100644 --- a/block.c +++ b/block.c @@ -3279,9 +3279,9 @@ fail: if (use_local_qiov) { qemu_iovec_destroy(&local_qiov); - qemu_vfree(head_buf); - qemu_vfree(tail_buf); } + qemu_vfree(head_buf); + qemu_vfree(tail_buf); return ret; } -- 1.8.1.4