From 9d0b324d5fe4163d39a43536d5730467a0a9655b Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Tue, 1 Sep 2020 14:23:40 -0400 Subject: [PATCH] pbrd: fix SA warning in nhg map Fix SA warnings in nhg map functions. Signed-off-by: Mark Stapp --- pbrd/pbr_map.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pbrd/pbr_map.c b/pbrd/pbr_map.c index cce97b5dfb..058881cbfc 100644 --- a/pbrd/pbr_map.c +++ b/pbrd/pbr_map.c @@ -785,8 +785,13 @@ void pbr_map_check_vrf_nh_group_change(const char *nh_group, if (pbrms->nhgrp_name) continue; - if (pbrms->nhg - && strcmp(nh_group, pbrms->internal_nhg_name)) + if (pbrms->nhg == NULL) + continue; + + if (strcmp(nh_group, pbrms->internal_nhg_name)) + continue; + + if (pbrms->nhg->nexthop == NULL) continue; if (pbrms->nhg->nexthop->vrf_id != old_vrf_id) @@ -810,8 +815,13 @@ void pbr_map_check_interface_nh_group_change(const char *nh_group, if (pbrms->nhgrp_name) continue; - if (pbrms->nhg - && strcmp(nh_group, pbrms->internal_nhg_name)) + if (pbrms->nhg == NULL) + continue; + + if (strcmp(nh_group, pbrms->internal_nhg_name)) + continue; + + if (pbrms->nhg->nexthop == NULL) continue; if (pbrms->nhg->nexthop->ifindex != oldifindex)