Download raw body.
bgpd: fix filterset leak in rde_filter_free()
On Thu, Apr 30, 2026 at 05:05:34PM +0200, Claudio Jeker wrote:
> rde_filter_free() needs to unref the rde_filtersets of all rules before
> calling free().
>
> There is no other referenced or allocated data in that array. To verify
> check out rde_filter_fill().
ok tb
> --
> :wq Claudio
>
> Index: rde_filter.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpd/rde_filter.c,v
> diff -u -p -r1.148 rde_filter.c
> --- rde_filter.c 27 Apr 2026 15:06:01 -0000 1.148
> +++ rde_filter.c 30 Apr 2026 15:02:16 -0000
> @@ -483,8 +483,13 @@ static struct rde_filtertable filter = C
> static void
> rde_filter_free(struct rde_filter *rf)
> {
> + size_t i;
> +
> if (rf == NULL)
> return;
> +
> + for (i = 0; i < rf->len; i++)
> + rde_filterset_unref(rf->rules[i].rde_set);
>
> rdemem.filter_size -= sizeof(*rf) + rf->len * sizeof(rf->rules[0]);
> rdemem.filter_cnt--;
>
bgpd: fix filterset leak in rde_filter_free()