From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xwn9R-0007fV-6X for qemu-devel@nongnu.org; Fri, 05 Dec 2014 02:18:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xwn9M-0002a1-DK for qemu-devel@nongnu.org; Fri, 05 Dec 2014 02:18:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48759) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xwn9M-0002Zr-53 for qemu-devel@nongnu.org; Fri, 05 Dec 2014 02:18:00 -0500 Message-ID: <1417763870.11297.4.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Fri, 05 Dec 2014 08:17:50 +0100 In-Reply-To: <1417750270-14056-1-git-send-email-arei.gonglei@huawei.com> References: <1417750270-14056-1-git-send-email-arei.gonglei@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: arei.gonglei@huawei.com Cc: pbonzini@redhat.com, weidong.huang@huawei.com, qemu-devel@nongnu.org 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. cheers, Gerd