bgpd: null check (Coverity 1399270)

Signed-off-by: F. Aragon <paco@voltanet.io>
This commit is contained in:
paco 2018-06-13 13:08:58 +02:00
parent 9eafc8abd7
commit cc32742c09
No known key found for this signature in database
GPG Key ID: FD112A8C7E6A5E4A
2 changed files with 3 additions and 4 deletions

View File

@ -102,6 +102,7 @@ struct community_list_handler *bgp_clist;
unsigned int multipath_num = MULTIPATH_NUM;
static void bgp_if_finish(struct bgp *bgp);
static void peer_drop_dynamic_neighbor(struct peer *peer);
extern struct zclient *zclient;
@ -3718,10 +3719,10 @@ struct peer *peer_lookup_dynamic_neighbor(struct bgp *bgp, union sockunion *su)
return peer;
}
void peer_drop_dynamic_neighbor(struct peer *peer)
static void peer_drop_dynamic_neighbor(struct peer *peer)
{
int dncount = -1;
if (peer->group && peer->group->bgp) {
if (peer->group->bgp) {
dncount = peer->group->bgp->dynamic_neighbors_count;
if (dncount)
peer->group->bgp->dynamic_neighbors_count = --dncount;
@ -3731,7 +3732,6 @@ void peer_drop_dynamic_neighbor(struct peer *peer)
peer->group->name, dncount);
}
/* If peer is configured at least one address family return 1. */
int peer_active(struct peer *peer)
{

View File

@ -1462,7 +1462,6 @@ extern struct peer_group *peer_group_lookup_dynamic_neighbor(struct bgp *,
struct prefix **);
extern struct peer *peer_lookup_dynamic_neighbor(struct bgp *,
union sockunion *);
extern void peer_drop_dynamic_neighbor(struct peer *);
/*
* Peers are incredibly easy to memory leak