From patchwork Sat Oct 8 12:07:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 9368131 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1FE576048F for ; Sat, 8 Oct 2016 12:08:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFC5829922 for ; Sat, 8 Oct 2016 12:08:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD14229990; Sat, 8 Oct 2016 12:08:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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 mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9039129922 for ; Sat, 8 Oct 2016 12:08:27 +0000 (UTC) Received: from localhost ([::1]:40874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsqQS-0007B2-SD for patchwork-qemu-devel@patchwork.kernel.org; Sat, 08 Oct 2016 08:08:24 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:subject:date; bh=9QNqLKOXJT1EkbV++4dPE0ZhaFh9HnKPS46Zyw95hYA=; b=BqWFDD3crmLmVTM2CBE1AzwLPBFFkOjTEhhX1rzdv5aiD9RbktltBRCBbeEiJkzZRy xm4ENMBLZL4zoGao5YFhwhB2BAW5bAQzNBAyAmMmt1YtCX7AevKcl0b3wReBmsZnQ59F 0vqeLy+5vmG6lZwfTyortzIdkdmXQdWuDoZJSyYmI8glS+ADV9kSsPGuk0Dc/Mcz/NzB q5ovmwUi6dQgQzjcDm107NHTpRuEXs0Nha2ZvHdlwDM7ylKfD/cKdwxDs/TL9SvNCOOD 2IR4Z6Cw4jBv0xLCLR4ra5gUWQIg6Ix7GAMjpgJkDaoLGCp1xajJhuBowIl7qzTsAKcY X6CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:cc:subject:date; bh=9QNqLKOXJT1EkbV++4dPE0ZhaFh9HnKPS46Zyw95hYA=; b=CwSuWV5C1GINVvJSzVuTIwTij4qr6MSHVcgid/10RH5WzSkm3lYLM4NMaW/avosESO LC9epWDNUo5vdfaFfuvXOgjUE66QpKpPYqn4z7FGVV8J0EkE4+xpfZYWCTfBD8/w58x3 D1ZUrZBV/qYeZ/dDWeWCuN6wmcPxgCnKckxqDSRAu0BjoGEB7wEzBc+P8qOFEisQlFAK LnsdPng507iIJ6l7L0OJPt+5dk1GfxybG09Jlwv+5zJjKXGBRe4/D7KRHZdTIOtoNNud /9xIbHeuD7oToVeOiQS0eRhs8Cc/dzhHQLQakn9yvQ9bHovdcHRQAOQUt3DmtL39pZWs j7uA== X-Gm-Message-State: AA6/9RksB6sXKh9sgvTIXtmQ/JnuDXjWfo26TRpUyPt/R/DAD5A6piOZ2VtVEiaq87R4Cg== X-Received: by 10.194.134.102 with SMTP id pj6mr20574063wjb.187.1475928458974; Sat, 08 Oct 2016 05:07:38 -0700 (PDT) Received: from localhost.localdomain.localdomain ([104.192.110.250]) by smtp.gmail.com with ESMTPSA id y4sm7982322wmy.22.2016.10.08.05.07.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Oct 2016 05:07:38 -0700 (PDT) Message-ID: <57f8e18a.04321c0a.35f53.8b64@mx.google.com> X-Google-Original-Message-ID: <1475928445-4776-1-git-send-email-Qiang(liqiang6-s@360.cn)> From: Li Qiang X-Google-Original-From: Li Qiang(liqiang6-s@360.cn) To: jasowang@redhat.com, qemu-devel@nongnu.org Date: Sat, 8 Oct 2016 05:07:25 -0700 X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH] 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: Li Qiang Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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); }