]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Don't check for NULL when removing chunks 12224/head
authorCarmine Scarpitta <carmine.scarpitta@uniroma2.it>
Sat, 29 Oct 2022 15:31:16 +0000 (17:31 +0200)
committerCarmine Scarpitta <carmine.scarpitta@uniroma2.it>
Sat, 29 Oct 2022 15:31:16 +0000 (17:31 +0200)
`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>
bgpd/bgp_vty.c

index 8c3f2bf9b731716420cd0054f7afcf684582ef44..a849eb02ec5cae032955bb6f23fbd1785bbb1bba 100644 (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);