bgpd: Don't always allocate json memory in non-json path

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2022-12-08 18:22:17 -05:00
parent 57968e38a9
commit 5691f760d2

View File

@ -775,7 +775,8 @@ static int update_group_show_walkcb(struct update_group *updgrp, void *arg)
: ""); : "");
} }
} }
json_subgrps = json_object_new_array(); if (ctx->uj)
json_subgrps = json_object_new_array();
UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) { UPDGRP_FOREACH_SUBGRP (updgrp, subgrp) {
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id)) if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
continue; continue;