]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_lcommunity.c
Merge pull request #3755 from kirankella/show_bgp_neigh_af_fix
[mirror_frr.git] / bgpd / bgp_lcommunity.c
index 33f4d139b8271027baecad6b7355a119f578024b..2106b9d521ecc2a8057b7d6a4e72cc4c8fcd023b 100644 (file)
@@ -50,7 +50,6 @@ void lcommunity_free(struct lcommunity **lcom)
        if ((*lcom)->str)
                XFREE(MTYPE_LCOMMUNITY_STR, (*lcom)->str);
        XFREE(MTYPE_LCOMMUNITY, *lcom);
-       lcom = NULL;
 }
 
 static void lcommunity_hash_free(struct lcommunity *lcom)
@@ -319,6 +318,12 @@ int lcommunity_cmp(const void *arg1, const void *arg2)
        const struct lcommunity *lcom1 = arg1;
        const struct lcommunity *lcom2 = arg2;
 
+       if (lcom1 == NULL && lcom2 == NULL)
+               return 1;
+
+       if (lcom1 == NULL || lcom2 == NULL)
+               return 0;
+
        return (lcom1->size == lcom2->size
                && memcmp(lcom1->val, lcom2->val, lcom_length(lcom1)) == 0);
 }