From 9e7b1be6e2d25663b3a997edd0ec8e9e603a770c Mon Sep 17 00:00:00 2001
From: wuchangsheng <wuchangsheng2@huawei.com>
Date: Mon, 19 Jul 2021 23:09:53 +0800
Subject: [PATCH] test

---
 lib/librte_eal/common/eal_common_fbarray.c | 15 +++++++++------
 lib/librte_eal/linux/eal/eal.c             |  1 +
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c
index d1aa074..adfcd09 100644
--- a/lib/librte_eal/common/eal_common_fbarray.c
+++ b/lib/librte_eal/common/eal_common_fbarray.c
@@ -915,18 +915,21 @@ __rte_fbarray_attach(struct rte_fbarray *arr, const char *runtime_dir,
 		fd = -1;
 	}
 
-	/* store our new memory area */
-	ma->addr = data;
-	ma->fd = fd; /* keep fd until detach/destroy */
-	ma->len = mmap_len;
 
 	if (!internal_cfg->pri_and_sec) {
+	        /* store our new memory area */
+	        ma->addr = data;
+	        ma->fd = fd; /* keep fd until detach/destroy */
+	        ma->len = mmap_len;
+
 		TAILQ_INSERT_TAIL(&mem_area_tailq, ma, next);
 
 		/* we're done */
-
 		rte_spinlock_unlock(&mem_area_lock);
-	}
+	} else {
+                /* pri_and_sec don't use mem_area_tailq */
+                free(ma);
+        }
 	return 0;
 fail:
 	if (data)
diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index 4385031..92f1b56 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -608,6 +608,7 @@ eal_sec_config_cleanup(const int sec_idx)
 	}
 
 	memset(lc_rte_cfg, 0, sizeof(*lc_rte_cfg));
+	eal_cleanup_config(lc_internal_cfg);
 	memset(lc_internal_cfg, 0, sizeof(*lc_internal_cfg));
 	memset(lc_runtime_dir, 0, PATH_MAX);
 
-- 
2.23.0

