From 68a63f60ae495823cc9cc6f4fe6caaaec2f1b670 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 17 Apr 2018 17:59:47 -0400 Subject: [PATCH] pbrd: remove potential null dereference Coverity #1467832 Signed-off-by: Quentin Young --- pbrd/pbr_nht.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c index 1ce8c2104d..4a420c3e84 100644 --- a/pbrd/pbr_nht.c +++ b/pbrd/pbr_nht.c @@ -209,6 +209,13 @@ void pbr_nhgroup_add_cb(const char *name) struct nexthop_group_cmd *nhgc; nhgc = nhgc_find(name); + + if (!nhgc) { + DEBUGD(&pbr_dbg_nht, "%s: Could not find nhgc with name: %s\n", + __PRETTY_FUNCTION__, name); + return; + } + pnhgc = pbr_nht_add_group(name); DEBUGD(&pbr_dbg_nht, "%s: Added nexthop-group %s", __PRETTY_FUNCTION__,