From patchwork Wed Oct 26 02:24:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 686855 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3t3YmG5x68z9sf9 for ; Wed, 26 Oct 2016 13:26:06 +1100 (AEDT) Received: from localhost ([::1]:59211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzDum-0001eH-Lv for incoming@patchwork.ozlabs.org; Tue, 25 Oct 2016 22:26:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzDtJ-0000R5-Az for qemu-devel@nongnu.org; Tue, 25 Oct 2016 22:24:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzDtF-0000cV-DD for qemu-devel@nongnu.org; Tue, 25 Oct 2016 22:24:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43630) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bzDtF-0000cP-82 for qemu-devel@nongnu.org; Tue, 25 Oct 2016 22:24:29 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4105E8EB5A; Wed, 26 Oct 2016 02:24:28 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (vpn1-4-153.pek2.redhat.com [10.72.4.153]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9Q2ODrS012588; Tue, 25 Oct 2016 22:24:25 -0400 From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 26 Oct 2016 10:24:06 +0800 Message-Id: <1477448651-4474-5-git-send-email-jasowang@redhat.com> In-Reply-To: <1477448651-4474-1-git-send-email-jasowang@redhat.com> References: <1477448651-4474-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 26 Oct 2016 02:24:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/9] net: eepro100: fix memory leak in device uninit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Li Qiang Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Signed-off-by: Jason Wang --- 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); }