bgpd: Don't check for NULL when removing chunks

`srv6_locator_chunk_free()` is a wrapper around the `XFREE()` macro.
Passing a NULL pointer to `XFREE()` is safe. Therefore, checking that
the pointer passed to the `srv6_locator_chunk_free()` is not null is
unnecessary.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
This commit is contained in:
Carmine Scarpitta 2022-10-29 17:31:16 +02:00
parent a1d5e05fb3
commit efae8c26cb

View File

@ -297,7 +297,7 @@ static int bgp_srv6_locator_unset(struct bgp *bgp)
{
int ret;
struct listnode *node, *nnode;
struct srv6_locator_chunk *chunk, *tovpn_sid_locator;
struct srv6_locator_chunk *chunk;
struct bgp_srv6_function *func;
struct bgp *bgp_vrf;
@ -345,18 +345,12 @@ static int bgp_srv6_locator_unset(struct bgp *bgp)
continue;
/* refresh vpnv4 tovpn_sid_locator */
tovpn_sid_locator =
bgp_vrf->vpn_policy[AFI_IP].tovpn_sid_locator;
if (tovpn_sid_locator)
srv6_locator_chunk_free(
&bgp_vrf->vpn_policy[AFI_IP].tovpn_sid_locator);
srv6_locator_chunk_free(
&bgp_vrf->vpn_policy[AFI_IP].tovpn_sid_locator);
/* refresh vpnv6 tovpn_sid_locator */
tovpn_sid_locator =
bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid_locator;
if (tovpn_sid_locator)
srv6_locator_chunk_free(&bgp_vrf->vpn_policy[AFI_IP6]
.tovpn_sid_locator);
srv6_locator_chunk_free(
&bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid_locator);
/* refresh per-vrf tovpn_sid_locator */
srv6_locator_chunk_free(&bgp_vrf->tovpn_sid_locator);