From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bx3DV-0003Re-RY for qemu-devel@nongnu.org; Wed, 19 Oct 2016 22:36:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bx3DR-00063q-Ub for qemu-devel@nongnu.org; Wed, 19 Oct 2016 22:36:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37716) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bx3DR-00063K-P5 for qemu-devel@nongnu.org; Wed, 19 Oct 2016 22:36:21 -0400 References: <57f8e18a.04321c0a.35f53.8b64@mx.google.com> From: Jason Wang Message-ID: <6e557b80-762c-6bb6-4ed8-b0c2cc822bfc@redhat.com> Date: Thu, 20 Oct 2016 10:36:14 +0800 MIME-Version: 1.0 In-Reply-To: <57f8e18a.04321c0a.35f53.8b64@mx.google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] net: eepro100: fix memory leak in device uninit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Li Qiang , qemu-devel@nongnu.org Cc: Li Qiang On 2016=E5=B9=B410=E6=9C=8808=E6=97=A5 20:07, Li Qiang wrote: > 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 =3D DO_UPCAST(EEPRO100State, dev, pci_dev); > =20 > vmstate_unregister(&pci_dev->qdev, s->vmstate, s); > + g_free(s->vmstate); > eeprom93xx_free(&pci_dev->qdev, s->eeprom); > qemu_del_nic(s->nic); > } Applied, thanks. We may want to switch to use dc->vmsd instead of this in the future.