Use function attributes to catch cases where member table is allocated
but not freed correctly.

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 lib/member/rte_member.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/lib/member/rte_member.h b/lib/member/rte_member.h
index 109bdd000b..0235bb0a81 100644
--- a/lib/member/rte_member.h
+++ b/lib/member/rte_member.h
@@ -341,6 +341,16 @@ struct __rte_cache_aligned rte_member_parameters {
 struct rte_member_setsum *
 rte_member_find_existing(const char *name);
 
+/**
+ * De-allocate memory used by set-summary.
+ *
+ * @param setsum
+ *   Pointer to the set summary.
+ *   If setsum is NULL, no operation is performed.
+ */
+void
+rte_member_free(struct rte_member_setsum *setsum);
+
 /**
  * Create set-summary (SS).
  *
@@ -351,7 +361,8 @@ rte_member_find_existing(const char *name);
  *   Return value is NULL if the creation failed.
  */
 struct rte_member_setsum *
-rte_member_create(const struct rte_member_parameters *params);
+rte_member_create(const struct rte_member_parameters *params)
+       __rte_malloc __rte_dealloc(rte_member_free, 1);
 
 /**
  * Lookup key in set-summary (SS).
@@ -528,17 +539,6 @@ int
 rte_member_report_heavyhitter(const struct rte_member_setsum *setsum,
                              void **keys, uint64_t *counts);
 
-
-/**
- * De-allocate memory used by set-summary.
- *
- * @param setsum
- *   Pointer to the set summary.
- *   If setsum is NULL, no operation is performed.
- */
-void
-rte_member_free(struct rte_member_setsum *setsum);
-
 /**
  * Reset the set-summary tables. E.g. reset bits to be 0 in BF,
  * reset set_id in each entry to be RTE_MEMBER_NO_MATCH in HT based SS.
-- 
2.45.2

Reply via email to