From 3e347f4181db349299b2dd05bea11b030770af71 Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Mon, 12 Aug 2019 18:13:30 -0400 Subject: [PATCH] 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 --- zebra/zebra_nhg.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index a9c0f8002d..c22bf349b7 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -820,11 +820,21 @@ static int nhg_ctx_process_del(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 * based on flag. */ + if (nhg_ctx_get_count(ctx)) + goto done; + + nh = nhg_ctx_get_nh(ctx); + + nexthop_del_labels(nh); + +done: if (ctx) nhg_ctx_free(ctx); } -- 2.39.5