From 11b987ed2f7d85fa3a6e2c05add3ab7f34834ba5 Mon Sep 17 00:00:00 2001 From: Rajasekar Raja Date: Mon, 9 Oct 2023 16:54:54 +0000 Subject: [PATCH] zebra: Prevent leaking ctx memory in err condition When netlink_link_change() errors out for a new link for interface without MTU set, the allocated ctx is not freed.. Adding code for correctness Ticket# 3628313 Signed-off-by: Rajasekar Raja --- zebra/if_netlink.c | 1 + 1 file changed, 1 insertion(+) diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 61a8c6a78a..ed2e0a224e 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -1622,6 +1622,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) zlog_debug( "RTM_NEWLINK for interface %s(%u) without MTU set", name, ifi->ifi_index); + dplane_ctx_fini(&ctx); return 0; } dplane_ctx_set_ifp_mtu(ctx, *(int *)RTA_DATA(tb[IFLA_MTU])); -- 2.39.5