From 59402d840e517d4bd08cb7b70d25739e88d78cef Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 3 Jul 2023 12:55:48 -0400 Subject: [PATCH] ospfd: Ensure `show ip ospf interface` json code is guarded When not using json, do not allocate json memory. Signed-off-by: Donald Sharp --- ospfd/ospf_vty.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 74eb5c7620..863055bf42 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -3690,7 +3690,8 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf, "Use all fields following ospfEnabled from interfaceIp hierarchy") #endif - json_oi = json_object_new_object(); + if (use_json) + json_oi = json_object_new_object(); if (CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED)) { if (use_json) { -- 2.39.5