From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwnEQ-0001fu-Hm for qemu-devel@nongnu.org; Fri, 05 Dec 2014 02:23:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwnEL-00049E-GK for qemu-devel@nongnu.org; Fri, 05 Dec 2014 02:23:14 -0500 Received: from szxga01-in.huawei.com ([119.145.14.64]:34693) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwnEK-00047a-Qu for qemu-devel@nongnu.org; Fri, 05 Dec 2014 02:23:09 -0500 Message-ID: <54815D3C.1090608@huawei.com> Date: Fri, 5 Dec 2014 15:22:36 +0800 From: Gonglei MIME-Version: 1.0 References: <1417750270-14056-1-git-send-email-arei.gonglei@huawei.com> <1417763870.11297.4.camel@nilsson.home.kraxel.org> In-Reply-To: <1417763870.11297.4.camel@nilsson.home.kraxel.org> Content-Type: text/plain; charset="UTF-8" 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: Gerd Hoffmann Cc: "pbonzini@redhat.com" , "Huangweidong (C)" , "qemu-devel@nongnu.org" 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 ? Regards, -Gonglei