]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: clean up nhg allocations in error path
authorMark Stapp <mjs.ietf@gmail.com>
Wed, 11 Aug 2021 14:41:53 +0000 (10:41 -0400)
committerMark Stapp <mjs.ietf@gmail.com>
Wed, 11 Aug 2021 14:41:53 +0000 (10:41 -0400)
Clean up allocated nhgs in error path in zread_nhg_add().

Signed-off-by: Mark Stapp <mjs.ietf@gmail.com>
zebra/zapi_msg.c

index 27fb5d7c228f27292c34fc39b4d4b6149d47558e..b16128cea72a926d581e3830efb44b01b153770b 100644 (file)
@@ -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;
        }