From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9tAX-0007M7-Tr for qemu-devel@nongnu.org; Thu, 24 Nov 2016 07:30:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9tAW-0000uH-PM for qemu-devel@nongnu.org; Thu, 24 Nov 2016 07:30:25 -0500 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]:33133) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c9tAW-0000tu-Ja for qemu-devel@nongnu.org; Thu, 24 Nov 2016 07:30:24 -0500 Received: by mail-oi0-x244.google.com with SMTP id f201so2901782oib.0 for ; Thu, 24 Nov 2016 04:30:24 -0800 (PST) From: Li Qiang Date: Thu, 24 Nov 2016 07:30:09 -0500 Message-Id: <1479990609-28243-3-git-send-email-liq3ea@gmail.com> In-Reply-To: <1479990609-28243-1-git-send-email-liq3ea@gmail.com> References: <1479990609-28243-1-git-send-email-liq3ea@gmail.com> Subject: [Qemu-devel] [PATCH 2/2] virtio-gpu: call cleanup mapping function in resource destroy List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kraxel@redhat.com, marcandre.lureau@gmail.com, qemu-devel@nongnu.org Cc: liqiang6-s@360.cn, Li Qiang If the guest destroy the resource before detach banking, the 'iov' and 'addrs' field in resource is not freed thus leading memory leak issue. This patch avoid this. Signed-off-by: Li Qiang --- hw/display/virtio-gpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index cc725a6..98dadf2 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -360,6 +360,7 @@ static void virtio_gpu_resource_destroy(VirtIOGPU *g, struct virtio_gpu_simple_resource *res) { pixman_image_unref(res->image); + virtio_gpu_cleanup_mapping(res); QTAILQ_REMOVE(&g->reslist, res, next); g_free(res); } -- 1.8.3.1