From 2c7d402164cc027a62be8ed2be2ffb25b17da1bd Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Mon, 22 Jan 2018 11:30:05 +0100 Subject: [PATCH] zebra: fix static analysis issue with zvrf_id Using c-lang scan-build tool, fix a dereference of a null pointer. Signed-off-by: Philippe Guibert --- zebra/zebra_vrf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zebra/zebra_vrf.h b/zebra/zebra_vrf.h index 4d53eee093..3b9e930969 100644 --- a/zebra/zebra_vrf.h +++ b/zebra/zebra_vrf.h @@ -128,6 +128,8 @@ struct zebra_vrf { static inline vrf_id_t zvrf_id(struct zebra_vrf *zvrf) { + if (!zvrf || !zvrf->vrf) + return VRF_UNKNOWN; return zvrf->vrf->vrf_id; } -- 2.39.5