> Use function attributes to catch cases where acl table is allocated
> but not freed correctly.
>
> Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
> ---
> lib/acl/rte_acl.h | 26 +++++++++++++++-----------
> 1 file changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/lib/acl/rte_acl.h b/lib/acl/rte_acl.h
> index ca75a6f220..b95f8778c3 100644
> --- a/lib/acl/rte_acl.h
> +++ b/lib/acl/rte_acl.h
> @@ -133,6 +133,19 @@ struct rte_acl_param {
> };
>
>
> +/** @internal opaque ACL handle */
> +struct rte_acl_ctx;
> +
> +/**
> + * De-allocate all memory used by ACL context.
> + *
> + * @param ctx
> + * ACL context to free
> + * If ctx is NULL, no operation is performed.
> + */
> +void
> +rte_acl_free(struct rte_acl_ctx *ctx);
> +
> /**
> * Create a new ACL context.
> *
> @@ -145,7 +158,8 @@ struct rte_acl_param {
> * - EINVAL - invalid parameter passed to function
> */
> struct rte_acl_ctx *
> -rte_acl_create(const struct rte_acl_param *param);
> +rte_acl_create(const struct rte_acl_param *param)
> + __rte_malloc __rte_dealloc(rte_acl_free, 1);
>
> /**
> * Find an existing ACL context object and return a pointer to it.
> @@ -160,16 +174,6 @@ rte_acl_create(const struct rte_acl_param *param);
> struct rte_acl_ctx *
> rte_acl_find_existing(const char *name);
>
> -/**
> - * De-allocate all memory used by ACL context.
> - *
> - * @param ctx
> - * ACL context to free
> - * If ctx is NULL, no operation is performed.
> - */
> -void
> -rte_acl_free(struct rte_acl_ctx *ctx);
> -
> /**
> * Add rules to an existing ACL context.
> * This function is not multi-thread safe.
> --
Acked-by: Konstantin Ananyev <konstantin.anan...@huawei.com>
> 2.45.2