summaryrefslogtreecommitdiff
path: root/proto/bgp/bgp.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2016-11-25 11:51:38 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2016-11-25 11:51:38 +0100
commited1a908e535e4333b358d83b472453a2ad6d3f51 (patch)
tree3ee46e6d922c3e363dad23976fcc2de0a7e19429 /proto/bgp/bgp.c
parent261816b0d4f3d4549a4402b95541b82fc7f10a4b (diff)
BGP: Fix memory leak in graceful restart code
Prefix and bucket tables are initialized when entering established state but not explicitly freed when leaving it (that is handled by protocol restart). With graceful restart, BGP may enter and leave established state multiple times without hard protocol restart causing memory leak.
Diffstat (limited to 'proto/bgp/bgp.c')
-rw-r--r--proto/bgp/bgp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 8ef4b990..0f1c9446 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -416,6 +416,9 @@ bgp_conn_leave_established_state(struct bgp_proto *p)
BGP_TRACE(D_EVENTS, "BGP session closed");
p->conn = NULL;
+ bgp_free_prefix_table(p);
+ bgp_free_bucket_table(p);
+
if (p->p.proto_state == PS_UP)
bgp_stop(p, 0);
}