summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_connection.c')
-rw-r--r--bgpd/bgp_connection.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/bgpd/bgp_connection.c b/bgpd/bgp_connection.c
index 690b2903..dcfd57e7 100644
--- a/bgpd/bgp_connection.c
+++ b/bgpd/bgp_connection.c
@@ -572,8 +572,16 @@ bgp_connection_close(bgp_connection connection)
bgp_connection_disable_accept(connection) ;
/* forget any addresses */
- sockunion_clear(connection->su_local) ;
- sockunion_clear(connection->su_remote) ;
+ if (connection->su_local != NULL)
+ {
+ sockunion_clear(connection->su_local) ;
+ connection->su_local = NULL;
+ }
+ if (connection->su_remote != NULL)
+ {
+ sockunion_clear(connection->su_remote) ;
+ connection->su_remote = NULL;
+ }
/* Unset all the timers */
qtimer_unset(&connection->hold_timer) ;