[LEDE-DEV] [PATCH] uci: decrement package's section counter when free'ing sections

Felix Fietkau nbd at nbd.name
Tue Sep 13 13:52:43 PDT 2016


On 2016-09-13 16:25, Reiner Herrmann wrote:
> The counter is incremented during section allocation, but never
> decremented.
> 
> Signed-off-by: Reiner Herrmann <reiner at reiner-h.de>
> ---
>  list.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/list.c b/list.c
> index 321861c..a2be150 100644
> --- a/list.c
> +++ b/list.c
> @@ -213,6 +213,7 @@ uci_free_section(struct uci_section *s)
>  	if ((s->type != uci_dataptr(s)) &&
>  		(s->type != NULL))
>  		free(s->type);
> +	s->package->n_section--;
NACK. n_section is used for hashing only, decrementing it here probably
makes collisions for anonymous sections more likely.

- Felix



More information about the Lede-dev mailing list