From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EAEEAA0C47; Sun, 25 Jul 2021 04:03:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7524240A4B; Sun, 25 Jul 2021 04:03:40 +0200 (CEST) Received: from m12-15.163.com (m12-15.163.com [220.181.12.15]) by mails.dpdk.org (Postfix) with ESMTP id 01DA840141 for ; Sun, 25 Jul 2021 04:03:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=1w0ew E2bp4NSnnKxqw9NDrUrQpo7rRZ67oryEaTNCfw=; b=Hsj5CX+vHdHrHyWIyfVQT M9TR5CLFdcEnMOTFNFQ0509oCFzaQi2wIGrZNJVM/qv0K2cW9P/O9+HTiQhz9qGO UeYN1eROxfk/OpMUjrEyz1HJMBjdumU1CnMMwFs3hLBGi5mzCTnNPwFpuFLMTFfh NsUuyNkl8jRKUsPPKl5YxY= Received: from DESKTOP-ONA2IA7.localdomain (unknown [39.182.54.79]) by smtp11 (Coremail) with SMTP id D8CowAAn5ihxxvxgDuO_AQ--.22394S4; Sun, 25 Jul 2021 10:03:34 +0800 (CST) From: Gaoxiang Liu To: Maxime Coquelin , Chenbo Xia Cc: dev@dpdk.org, liugaoxiang@huawei.com, Gaoxiang Liu Date: Sun, 25 Jul 2021 10:03:14 +0800 Message-Id: <20210725020315.15010-1-clgx0086@163.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: D8CowAAn5ihxxvxgDuO_AQ--.22394S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrZw43Cr1fCF48WryxCw43GFg_yoWkKwc_Gr 17CFy7XF18CFsakrWjkr1rXrWay3y8tF4UX3y3t34Fg34UJa47Xr12v3s5WFnrWw13ZF4D Zrs3Jr98Z34SkjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUUySrUUUUUU== X-Originating-IP: [39.182.54.79] X-CM-SenderInfo: hfoj5iqqywqiywtou0bp/1tbiWxbaelSIq7jN2AAAs3 Subject: [dpdk-dev] [PATCH] net/virtio: fix memory leak in dev close X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Free the "intr_handle" memory in virtio_user_dev_uninit() to avoid memory leak. when virtio user dev closes, the "intr_handle" memory is not freeed that is alloced in virtio_user_fill_intr_handle(). Fixes: 7f468b2ebfad ("net/virtio: release port upon close") Signed-off-by: Gaoxiang Liu --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 1cd1e95f4..16c58710d 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -654,6 +654,13 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, void virtio_user_dev_uninit(struct virtio_user_dev *dev) { + struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->hw.port_id]; + + if (eth_dev->intr_handle) { + free(eth_dev->intr_handle); + eth_dev->intr_handle = NULL; + } + virtio_user_stop_device(dev); rte_mem_event_callback_unregister(VIRTIO_USER_MEM_EVENT_CLB_NAME, dev); -- 2.32.0