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 2BF23A0C47; Mon, 26 Jul 2021 14:00:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D8FD140F35; Mon, 26 Jul 2021 14:00:11 +0200 (CEST) Received: from m12-18.163.com (m12-18.163.com [220.181.12.18]) by mails.dpdk.org (Postfix) with ESMTP id 3210E40DDA for ; Mon, 26 Jul 2021 14:00:08 +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=1iLrL kIxgQ2BOQzt1HINidcT4hpli4Pt1bdVOh0V14c=; b=hURMowtkebBvbFZL8/n5s vgUfz9uJGaYvtYSBYJxHkW1zSfDpkeY9LqBr8d3YRCEmF/+mWcM3julnKN2jZ2PU g4HCRaNue/kOUb8yeG0fV4D0f2KD/fhIc8xDcSlotAvn86ZhUmUxscsxV/G8so/3 HYffo0JdCsKyTyg4TD20Y8= Received: from DESKTOP-ONA2IA7.localdomain (unknown [39.182.54.79]) by smtp14 (Coremail) with SMTP id EsCowAB30tS4o_5gEl+Iwg--.41256S4; Mon, 26 Jul 2021 20:00:04 +0800 (CST) From: Gaoxiang Liu To: chenbo.xia@intel.com, dev@dpdk.org, liugaoxiang@huawei.com Cc: Gaoxiang Liu Date: Mon, 26 Jul 2021 19:59:51 +0800 Message-Id: <20210726115951.92-1-clgx0086@163.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210725020315.15010-1-clgx0086@163.com> References: <20210725020315.15010-1-clgx0086@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: EsCowAB30tS4o_5gEl+Iwg--.41256S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrtFy5CFWfuw4UXr13ur47twb_yoWkKwb_Gr yxCFy7XF18GFnIkrWjkr1rXFWayay8tF4UZ3yaq34FgF1UA3W7Xr12v34kWFnrWw13ZF1D Xrs3Jr98Z34SkjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUjcyCtUUUUU== X-Originating-IP: [39.182.54.79] X-CM-SenderInfo: hfoj5iqqywqiywtou0bp/xtbBQgTbel++MrMmHQAAs8 Subject: [dpdk-dev] [PATCH] net/virtio: fix memory leak of interrupt handle 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 memory of interrupt handle in virtio_user_dev_uninit() to avoid memory leak. when virtio user dev closes, the "intr_handle" memory is not freed that is allocated in virtio_user_fill_intr_handle(). Fixes: 3d4fb6fd2505 <"net/virtio-user: support Rx interrupt"> 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