> 
> Use function attributes to catch cases where ring is allocated
> but not freed correctly.
> 
> Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
> ---
>  lib/ring/rte_ring.h | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/ring/rte_ring.h b/lib/ring/rte_ring.h
> index 63a71d5871..15340a1981 100644
> --- a/lib/ring/rte_ring.h
> +++ b/lib/ring/rte_ring.h
> @@ -119,6 +119,16 @@ ssize_t rte_ring_get_memsize(unsigned int count);
>  int rte_ring_init(struct rte_ring *r, const char *name, unsigned int count,
>       unsigned int flags);
> 
> +
> +/**
> + * De-allocate all memory used by the ring.
> + *
> + * @param r
> + *   Ring to free.
> + *   If NULL then, the function does nothing.
> + */
> +void rte_ring_free(struct rte_ring *r);
> +
>  /**
>   * Create a new ring named *name* in memory.
>   *
> @@ -183,16 +193,8 @@ int rte_ring_init(struct rte_ring *r, const char *name, 
> unsigned int count,
>   *    - ENOMEM - no appropriate memory area found in which to create memzone
>   */
>  struct rte_ring *rte_ring_create(const char *name, unsigned int count,
> -                              int socket_id, unsigned int flags);
> -
> -/**
> - * De-allocate all memory used by the ring.
> - *
> - * @param r
> - *   Ring to free.
> - *   If NULL then, the function does nothing.
> - */
> -void rte_ring_free(struct rte_ring *r);
> +                              int socket_id, unsigned int flags)
> +     __rte_malloc __rte_dealloc(rte_ring_free, 1);
> 
>  /**
>   * Dump the status of the ring to a file.
> --

Acked-by: Konstantin Ananyev <konstantin.anan...@huawei.com>

> 2.45.2

Reply via email to