From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsqPn-0006xd-9U for qemu-devel@nongnu.org; Sat, 08 Oct 2016 08:07:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsqPk-0006c4-1x for qemu-devel@nongnu.org; Sat, 08 Oct 2016 08:07:43 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsqPj-0006b9-Qa for qemu-devel@nongnu.org; Sat, 08 Oct 2016 08:07:39 -0400 Received: by mail-wm0-x242.google.com with SMTP id 123so6745453wmb.3 for ; Sat, 08 Oct 2016 05:07:39 -0700 (PDT) Message-ID: <57f8e18a.04321c0a.35f53.8b64@mx.google.com> From: Li Qiang Date: Sat, 8 Oct 2016 05:07:25 -0700 Subject: [Qemu-devel] [PATCH] net: eepro100: fix memory leak in device uninit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: jasowang@redhat.com, qemu-devel@nongnu.org Cc: Li Qiang From: Li Qiang The exit dispatch of eepro100 network card device doesn't free the 's->vmstate' field which was allocated in device realize thus leading a host memory leak. This patch avoid this. Signed-off-by: Li Qiang --- hw/net/eepro100.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index bab4dbf..4bf71f2 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -1843,6 +1843,7 @@ static void pci_nic_uninit(PCIDevice *pci_dev) EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, pci_dev); vmstate_unregister(&pci_dev->qdev, s->vmstate, s); + g_free(s->vmstate); eeprom93xx_free(&pci_dev->qdev, s->eeprom); qemu_del_nic(s->nic); } -- 1.8.3.1