[v5,1/3] eal: fix memory leak when removing event_cb

Message ID 32d8f2e1dca7ba254e6f5667d7198fadf4477349.1603207676.git.wangyunjian@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series fixes for device event |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Yunjian Wang Oct. 21, 2020, 11:19 a.m. UTC
From: Yunjian Wang <wangyunjian@huawei.com>

The event_cb->dev_name is not freed when freeing event_cb,
and this causes a memory leak.

Fixes: a753e53d517b ("eal: add device event monitor framework")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
---
 lib/librte_eal/common/eal_common_dev.c | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 9e4f09d83e..363a2ca95e 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -526,6 +526,7 @@  rte_dev_event_callback_unregister(const char *device_name,
 		 */
 		if (event_cb->active == 0) {
 			TAILQ_REMOVE(&dev_event_cbs, event_cb, next);
+			free(event_cb->dev_name);
 			free(event_cb);
 			ret++;
 		} else {