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

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 lib/bitratestats/rte_bitrate.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/bitratestats/rte_bitrate.h b/lib/bitratestats/rte_bitrate.h
index 979a712837..0cd3a6227c 100644
--- a/lib/bitratestats/rte_bitrate.h
+++ b/lib/bitratestats/rte_bitrate.h
@@ -17,7 +17,6 @@ extern "C" {
  */
 struct rte_stats_bitrates;
 
-
 /**
  * Allocate a bitrate statistics structure
  *
@@ -25,7 +24,8 @@ struct rte_stats_bitrates;
  *   - Pointer to structure on success
  *   - NULL on error (zmalloc failure)
  */
-struct rte_stats_bitrates *rte_stats_bitrate_create(void);
+struct rte_stats_bitrates *rte_stats_bitrate_create(void)
+       __rte_malloc __rte_dealloc(rte_stats_bitrate_free, 1);
 
 /**
  * Free bitrate statistics structure
-- 
2.45.2

Reply via email to