]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: fix static analysis issue with zvrf_id
authorPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 22 Jan 2018 10:30:05 +0000 (11:30 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 27 Feb 2018 10:11:24 +0000 (11:11 +0100)
Using c-lang scan-build tool, fix a dereference of a null pointer.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
zebra/zebra_vrf.h

index 4d53eee093fe0787c76a58d9aeaeb76bebc944fc..3b9e9309696187e884062a6b5dcce969747bbcd3 100644 (file)
@@ -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;
 }