From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b50vg-00023Y-Eh for qemu-devel@nongnu.org; Mon, 23 May 2016 21:14:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b50ve-0004SC-I4 for qemu-devel@nongnu.org; Mon, 23 May 2016 21:14:39 -0400 Date: Tue, 24 May 2016 09:14:31 +0800 From: Fam Zheng Message-ID: <20160524011431.GC14601@ad.usersys.redhat.com> References: <1463764652-11290-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1463764652-11290-1-git-send-email-kwolf@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3] block: Fix bdrv_next() memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-block@nongnu.org, pbonzini@redhat.com, qemu-devel@nongnu.org On Fri, 05/20 19:17, Kevin Wolf wrote: > The bdrv_next() users all leaked the BdrvNextIterator after completing > the iteration. Simply changing bdrv_next() to free the iterator before > returning NULL at the end of list doesn't work because some callers exit > the loop before looking at all BDSes. > > This patch moves the BdrvNextIterator from the heap to the stack of > the caller and switches to a bdrv_first()/bdrv_next() interface for > initialising the iterator. > > Signed-off-by: Kevin Wolf Reviewed-by: Fam Zheng