From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwnUX-00049L-H8 for qemu-devel@nongnu.org; Fri, 05 Dec 2014 02:39:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwnUS-0001Tw-MM for qemu-devel@nongnu.org; Fri, 05 Dec 2014 02:39:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwnUS-0001To-Dm for qemu-devel@nongnu.org; Fri, 05 Dec 2014 02:39:48 -0500 Message-ID: <1417765179.11297.8.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Fri, 05 Dec 2014 08:39:39 +0100 In-Reply-To: <54815D3C.1090608@huawei.com> References: <1417750270-14056-1-git-send-email-arei.gonglei@huawei.com> <1417763870.11297.4.camel@nilsson.home.kraxel.org> <54815D3C.1090608@huawei.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] spice: fix memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gonglei Cc: "pbonzini@redhat.com" , "Huangweidong (C)" , "qemu-devel@nongnu.org" On Fr, 2014-12-05 at 15:22 +0800, Gonglei wrote: > On 2014/12/5 15:17, Gerd Hoffmann wrote: > > > On Fr, 2014-12-05 at 11:31 +0800, arei.gonglei@huawei.com wrote: > >> From: Gonglei > >> > >> If errors happen for middle items of channel_list, > >> qmp_query_spice_channels() return NULL, and varriable > >> cur_item going out of scope leaks the storage it points to. > >> Let's check for errors in advance avoid memory leak. > > > > I think we can simply turn that into an assert(). The flag is a > > compatibility thing for older spice-server versions. Meanwhile our > > minimum spice version requirement is new enough that we should never > > ever see this error, and if we do something went very seriously wrong. > > > Fine. Would you like version 2 ? yes, please. thanks, Gerd