From fd99142ab79e265840ebb1990d4348dfcf47de14 Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Wed, 11 Aug 2021 10:41:53 -0400 Subject: [PATCH] zebra: clean up nhg allocations in error path Clean up allocated nhgs in error path in zread_nhg_add(). Signed-off-by: Mark Stapp --- zebra/zapi_msg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 27fb5d7c22..b16128cea7 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1937,6 +1937,11 @@ static void zread_nhg_add(ZAPI_HANDLER_ARGS) flog_warn(EC_ZEBRA_NEXTHOP_CREATION_FAILED, "%s: Nexthop Group Creation failed", __func__); + + /* Free any local allocations */ + nexthop_group_delete(&nhg); + zebra_nhg_backup_free(&bnhg); + return; } -- 2.39.5