Merge pull request #2498 from pacovn/Coverity_1470098_Logically_dead_code

bgpd: json output fix (Coverity 1470098)
This commit is contained in:
Donald Sharp 2018-06-20 11:39:07 -04:00 committed by GitHub
commit 76cd18c9dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -223,21 +223,27 @@ int show_adj_route_vpn(struct vty *vty, struct peer *peer,
}
rd_header = 0;
}
route_vty_out_tmp(vty, &rm->p, attr,
SAFI_MPLS_VPN,
use_json, json_array);
if (use_json) {
char buf_a[BUFSIZ];
char buf_b[BUFSIZ];
sprintf(buf_a, "%s/%d",
inet_ntop(rm->p.family,
rm->p.u.val,
buf_b,
BUFSIZ),
rm->p.prefixlen);
json_object_object_add(
json_routes, buf_a,
json_array);
} else {
route_vty_out_tmp(
vty, &rm->p, attr,
SAFI_MPLS_VPN, use_json,
json_array);
}
}
}
if (use_json && rm) {
char buf_a[BUFSIZ];
char buf_b[BUFSIZ];
sprintf(buf_a, "%s/%d",
inet_ntop(rm->p.family, rm->p.u.val,
buf_b, BUFSIZ),
rm->p.prefixlen);
json_object_object_add(json_routes, buf_a,
json_array);
}
}
}
if (use_json) {