From patchwork Mon Oct 29 06:29:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10658789 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1AFFF14DE for ; Mon, 29 Oct 2018 06:33:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03FAC286C8 for ; Mon, 29 Oct 2018 06:33:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA7EF288B6; Mon, 29 Oct 2018 06:33:40 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 6DAF3286C8 for ; Mon, 29 Oct 2018 06:33:40 +0000 (UTC) Received: from localhost ([::1]:43751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gH17L-0006XB-OW for patchwork-qemu-devel@patchwork.kernel.org; Mon, 29 Oct 2018 02:33:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gH13l-0003Sb-60 for qemu-devel@nongnu.org; Mon, 29 Oct 2018 02:29:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gH13k-0008N0-JJ for qemu-devel@nongnu.org; Mon, 29 Oct 2018 02:29:57 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:39723) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gH13j-0008MR-5g; Mon, 29 Oct 2018 02:29:55 -0400 Received: by mail-pg1-x541.google.com with SMTP id r9-v6so3384176pgv.6; Sun, 28 Oct 2018 23:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eUrPwn27scENne7qkXB0eW5xWI5rRf7UrepNptN5TI8=; b=ZPcUBw6XtAJ95f+rH55xxKhEkC5SAXV6XeHPojrWk7Ww/SVyc0FjAcZgvgpkhNOeYc iMvBgI685rl69hbDRnlpm+IM95yyOUqSziw1B/4uo0JuEKd5Oyr0VWxPTfMKvgZU2sYS BQCqKm7AOz5OdhQ5qjSwk7XEAon7zsvYxExIcnaeaCBYbAQwG5maS+jKVcr3x5K7SZnG ApK0auK1VG7nXhM6xXA/HJmtwSs5eB0ZkK3f3YVAdDL4pbHpDL52K0EdRhQJ7zb5oINZ 7CZHyM7QNR8idTE1QQzvwH/TwOIFstiWjTkx9wYktvZqoUmawh0AqWDrPBEZDHxpIeKP DRlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eUrPwn27scENne7qkXB0eW5xWI5rRf7UrepNptN5TI8=; b=WJ/Ij7Tzd9dYba7cnL8donxjvmjwpYkmDErmWMdH5Nnuuov15K8KGcK6Oy6SXEErPq B+teFhDVxDTy/0O7bZBSkWBiU7GPt0teK8ErnHxIrWs8HAllRkKaogDX6RWWlLbjQKMl qyYrnHJDmLQiDmS8da9HchdDZHpbT2Xoyqd6u6kGS3q7rzjlE56CVMPq03xvKqYh9qFY hb1Rxqojnl4oM0RwoszTKYK50lTsDmAnNexV6Zc+o7vvWVebhaXz2xyYBUZA51+1borJ 23UkQpf3kRGfwlZO+Q3e9MKs8mMYaQa0gzsl+iKe8bxmuad3rKez7m89RdEoHlVaMV+F aySw== X-Gm-Message-State: AGRZ1gK8cAiHfN9AC13pqWRZ5MvFl1JUUmual8M4/4mq88n4GC9GdZQL sAVfH7VaxNh4d+8XgHbC980iK5NU X-Google-Smtp-Source: AJdET5cw3+x006yWFSoGQ1v4ZKpvmMeeiCSYC/oJXo3Cw+3MEXNumPxNumhSz/+YBmtEhDpFM8aulw== X-Received: by 2002:a63:9e58:: with SMTP id r24mr12983471pgo.264.1540794594357; Sun, 28 Oct 2018 23:29:54 -0700 (PDT) Received: from localhost.localdomain.localdomain ([103.65.40.101]) by smtp.gmail.com with ESMTPSA id 72-v6sm25734644pfl.126.2018.10.28.23.29.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Oct 2018 23:29:53 -0700 (PDT) From: Li Qiang To: keith.busch@intel.com, kwolf@redhat.com, mreitz@redhat.com Date: Sun, 28 Oct 2018 23:29:41 -0700 Message-Id: <1540794581-33578-3-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1540794581-33578-1-git-send-email-liq3ea@gmail.com> References: <1540794581-33578-1-git-send-email-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::541 Subject: [Qemu-devel] [PATCH 2/2] nvme: free cmbuf in nvme_exit 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 , qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This avoid a memory leak in unhotplug nvme device. Signed-off-by: Li Qiang Reviewed-by: Philippe Mathieu-Daudé --- hw/block/nvme.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 359a06d0ad..09d7c90259 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1332,6 +1332,9 @@ static void nvme_exit(PCIDevice *pci_dev) g_free(n->cq); g_free(n->sq); + if (n->cmb_size_mb) { + g_free(n->cmbuf); + } msix_uninit_exclusive_bar(pci_dev); }