From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agxAd-0007OV-RE for qemu-devel@nongnu.org; Fri, 18 Mar 2016 12:22:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agxAY-0004Iu-RZ for qemu-devel@nongnu.org; Fri, 18 Mar 2016 12:22:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48245) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agxAY-0004Im-MX for qemu-devel@nongnu.org; Fri, 18 Mar 2016 12:22:34 -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 (Postfix) with ESMTPS id 3E9F4C03BD56 for ; Fri, 18 Mar 2016 16:22:34 +0000 (UTC) Date: Fri, 18 Mar 2016 16:22:30 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20160318162230.GH2246@work-vm> References: <1458311463-28272-1-git-send-email-berrange@redhat.com> <1458311463-28272-3-git-send-email-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1458311463-28272-3-git-send-email-berrange@redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 02/28] io: avoid double-free when closing QIOChannelBuffer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: Amit Shah , qemu-devel@nongnu.org, Juan Quintela * Daniel P. Berrange (berrange@redhat.com) wrote: > The QIOChannelBuffer's close implementation will free > the internal data buffer. It failed to reset the pointer > to NULL though, so when the object is later finalized > it will free it a second time with predictable crash. > > Signed-off-by: Daniel P. Berrange Reviewed-by: Dr. David Alan Gilbert Dave > --- > io/channel-buffer.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/io/channel-buffer.c b/io/channel-buffer.c > index 3e5117b..43d7959 100644 > --- a/io/channel-buffer.c > +++ b/io/channel-buffer.c > @@ -140,6 +140,7 @@ static int qio_channel_buffer_close(QIOChannel *ioc, > QIOChannelBuffer *bioc = QIO_CHANNEL_BUFFER(ioc); > > g_free(bioc->data); > + bioc->data = NULL; > bioc->capacity = bioc->usage = bioc->offset = 0; > > return 0; > -- > 2.5.0 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK