]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Prevent leaking ctx memory in err condition
authorRajasekar Raja <rajasekarr@nvidia.com>
Mon, 9 Oct 2023 16:54:54 +0000 (16:54 +0000)
committerRajasekar Raja <rajasekarr@nvidia.com>
Mon, 9 Oct 2023 17:09:57 +0000 (17:09 +0000)
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 <rajasekarr@nvidia.com>
zebra/if_netlink.c

index 61a8c6a78a0e727f92ce1708307922f51cde016e..ed2e0a224e05ca8e1fde2aceacbdcbc15f728e0e 100644 (file)
@@ -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]));