Commit 28c2dbd753 for frr

commit 28c2dbd75380e50ddd189f2ab62a736697c8d752
Author: shashankak <shashankak@nvidia.com>
Date:   Tue Nov 3 05:59:21 2026 +0000

    zebra: show ip nht vrf all json returns only the last VRF

    show ip|ipv6 nht vrf all json allocates a new top-level JSON object on
    every VRF. Only the last VRF is printed and freed, and the JSON for
    every other VRF is leaked.

    This came in with 3e28b3d1 ("zebra: clean up a json object leak"), which
    moved the allocation from before the VRF loop to inside it.
    Allocate the top-level object once before the VRF loop and add each
    VRF to it.

    Signed-off-by: shashankak <shashankak@nvidia.com>

diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 44d3992cfe..380ad90b83 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -1073,6 +1073,9 @@ DEFPY (show_ip_nht,
 	if (vrf_all) {
 		struct vrf *vrf;

+		if (uj)
+			json = json_object_new_object();
+
 		RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
 			if ((zvrf = vrf->info) != NULL) {
 				resolve_via_default =
@@ -1081,7 +1084,6 @@ DEFPY (show_ip_nht,
 						: zvrf->zebra_rnh_ipv6_default_route;

 				if (uj) {
-					json = json_object_new_object();
 					json_vrf = json_object_new_object();
 					json_nexthop = json_object_new_object();
 					json_object_object_add(json,