zebra: Free labels on nhg_ctx from kernel

If we get a nexthop group from the kernel with labels
and queue it as a context to process later, we have to
free the label stack we allocated.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
Stephen Worley 2019-08-12 18:13:30 -04:00
parent 10200d4054
commit 3e347f4181

View File

@ -820,11 +820,21 @@ static int nhg_ctx_process_del(struct nhg_ctx *ctx)
static void nhg_ctx_process_finish(struct nhg_ctx *ctx) static void nhg_ctx_process_finish(struct nhg_ctx *ctx)
{ {
struct nexthop *nh;
/* /*
* Just freeing for now, maybe do something more in the future * Just freeing for now, maybe do something more in the future
* based on flag. * based on flag.
*/ */
if (nhg_ctx_get_count(ctx))
goto done;
nh = nhg_ctx_get_nh(ctx);
nexthop_del_labels(nh);
done:
if (ctx) if (ctx)
nhg_ctx_free(ctx); nhg_ctx_free(ctx);
} }