summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_updgrp.c7
-rw-r--r--bgpd/bgpd.c8
-rw-r--r--tests/aspath_test.c10
-rw-r--r--tests/bgp_mpath_test.c3
4 files changed, 16 insertions, 12 deletions
diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c
index 3ba476d086..cd7710b501 100644
--- a/bgpd/bgp_updgrp.c
+++ b/bgpd/bgp_updgrp.c
@@ -1577,8 +1577,11 @@ update_bgp_group_free (struct bgp *bgp)
AF_FOREACH (afid)
{
- hash_free(bgp->update_groups[afid]);
- bgp->update_groups[afid] = NULL;
+ if (bgp->update_groups[afid])
+ {
+ hash_free(bgp->update_groups[afid]);
+ bgp->update_groups[afid] = NULL;
+ }
}
}
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 9514f4de18..d821dc6d1b 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -2977,8 +2977,12 @@ bgp_free (struct bgp *bgp)
list_delete (bgp->group);
list_delete (bgp->peer);
- hash_free(bgp->peerhash);
- bgp->peerhash = NULL;
+
+ if (bgp->peerhash)
+ {
+ hash_free(bgp->peerhash);
+ bgp->peerhash = NULL;
+ }
if (bgp->name)
XFREE(MTYPE_BGP, bgp->name);
diff --git a/tests/aspath_test.c b/tests/aspath_test.c
index 8ba77b122b..10a1517b4d 100644
--- a/tests/aspath_test.c
+++ b/tests/aspath_test.c
@@ -134,7 +134,7 @@ static struct test_segment {
{ 0x4,0x3, 0x01,0xc8, 0x00,0x7b, 0x03,0x15 },
8,
{ "[123,456,789]",
- "[123,456,789]",
+ "",
0, 1, NOT_ALL_PRIVATE, 123, 1, NULL_ASN },
},
{ /* 9 */
@@ -672,12 +672,12 @@ static struct tests {
},
{ &test_segments[8], &test_segments[9],
{ "[123,456,789] (123 456 789) [111,222] 8722 {4196,48658}",
- "[123,456,789] (123 456 789) [111,222] 8722 {4196,48658}",
+ "8722 {4196,48658}",
2, 5, NOT_ALL_PRIVATE, 456, 1, NULL_ASN },
},
{ &test_segments[9], &test_segments[8],
{ "(123 456 789) [111,222] 8722 {4196,48658} [123,456,789]",
- "8722 {4196,48658} [123,456,789]",
+ "8722 {4196,48658}",
2, 5, NOT_ALL_PRIVATE, 48658, 1, NULL_ASN },
},
{ &test_segments[14], &test_segments[11],
@@ -969,8 +969,8 @@ validate (struct aspath *as, const struct test_spec *sp)
{
failed++;
fails++;
- printf ("confed_del: %s\n", aspath_print (asconfeddel));
- printf ("should be: %s\n", sp->shouldbe_delete_confed);
+ printf ("as-path minus confeds is: %s\n", aspath_print (asconfeddel));
+ printf ("as-path minus confeds should be: %s\n", sp->shouldbe_delete_confed);
}
/* aspath_str2aspath test */
if ((aspath_print (asstr) == NULL && sp->shouldbe != NULL)
diff --git a/tests/bgp_mpath_test.c b/tests/bgp_mpath_test.c
index e937784aae..3b0a3de052 100644
--- a/tests/bgp_mpath_test.c
+++ b/tests/bgp_mpath_test.c
@@ -104,9 +104,6 @@ bgp_create_fake (as_t *as, const char *name)
bgp->group = list_new ();
//bgp->group->cmp = (int (*)(void *, void *)) peer_group_cmp;
- bgp->rsclient = list_new ();
- //bgp->rsclient->cmp = (int (*)(void*, void*)) peer_cmp;
-
for (afi = AFI_IP; afi < AFI_MAX; afi++)
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
{