From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53683) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4THs-00032v-PK for qemu-devel@nongnu.org; Wed, 09 Nov 2016 08:51:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c4THq-0005DZ-T0 for qemu-devel@nongnu.org; Wed, 09 Nov 2016 08:51:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60354) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c4THq-0005DN-N6 for qemu-devel@nongnu.org; Wed, 09 Nov 2016 08:51:34 -0500 From: Gerd Hoffmann Date: Wed, 9 Nov 2016 14:33:30 +0100 Message-Id: <1478698412-4865-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1478698412-4865-1-git-send-email-kraxel@redhat.com> References: <1478698412-4865-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 1/2] usb: ehci: fix memory leak in ehci_init_transfer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Li Qiang , Gerd Hoffmann From: Li Qiang In ehci_init_transfer function, if the 'cpage' is bigger than 4, it doesn't free the 'p->sgl' once allocated previously thus leading a memory leak issue. This patch avoid this. Signed-off-by: Li Qiang Message-id: 5821c0f4.091c6b0a.e0c92.e811@mx.google.com Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-ehci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index f4ece9a..7622a3a 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -1190,6 +1190,7 @@ static int ehci_init_transfer(EHCIPacket *p) while (bytes > 0) { if (cpage > 4) { fprintf(stderr, "cpage out of range (%d)\n", cpage); + qemu_sglist_destroy(&p->sgl); return -1; } -- 1.8.3.1