Merge pull request #2550 from pacovn/Coverity_1399284_Dereference_null_return_value

ospfd: null check (Coverity 1399284)
This commit is contained in:
Jafar Al-Gharaibeh 2018-06-25 12:40:02 -04:00 committed by GitHub
commit 6bb6f26c4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -670,6 +670,16 @@ int ospf_redistribute_set(struct ospf *ospf, int type, unsigned short instance,
struct ospf_redist *red;
red = ospf_redist_lookup(ospf, type, instance);
if (red == NULL) {
zlog_err(
"Redistribute[%s][%d]: Lookup failed Type[%d] , Metric[%d]",
ospf_redist_string(type), instance,
metric_type(ospf, type, instance),
metric_value(ospf, type, instance));
return CMD_WARNING_CONFIG_FAILED;
}
if (ospf_is_type_redistributed(ospf, type, instance)) {
if (mtype != red->dmetric.type) {
red->dmetric.type = mtype;