Merge pull request #2478 from pacovn/Coverity_1408766_Dereference_after_null_check

bgpd: null check (Coverity 1408766)
This commit is contained in:
Russ White 2018-06-19 07:21:42 -04:00 committed by GitHub
commit e3ea4f7acb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,15 +228,13 @@ int show_adj_route_vpn(struct vty *vty, struct peer *peer,
use_json, json_array);
}
}
if (use_json) {
struct prefix *p;
if (use_json && rm) {
char buf_a[BUFSIZ];
char buf_b[BUFSIZ];
p = &rm->p;
sprintf(buf_a, "%s/%d",
inet_ntop(p->family, &p->u.prefix,
inet_ntop(rm->p.family, rm->p.u.val,
buf_b, BUFSIZ),
p->prefixlen);
rm->p.prefixlen);
json_object_object_add(json_routes, buf_a,
json_array);
}