summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <Jafaral@users.noreply.github.com>2018-06-25 12:40:02 -0400
committerGitHub <noreply@github.com>2018-06-25 12:40:02 -0400
commit6bb6f26c4e586fb8a4b2fb22cd05a76e14cdeb8e (patch)
treec54b044ecc0701bc2cd3fc81bb6ba9aaedd8ad9e
parentd2722bf362b211d347648c738e609d68d496f1e4 (diff)
parent162dbe419dfc3d3322b6eb555cfc10f4fa952e6f (diff)
Merge pull request #2550 from pacovn/Coverity_1399284_Dereference_null_return_value
ospfd: null check (Coverity 1399284)
-rw-r--r--ospfd/ospf_zebra.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 141ece9c7a..0a7776cced 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -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;