From 36d3e8d828e18c5c4cd097f659e3984ff02532cb Mon Sep 17 00:00:00 2001 From: Tom Goff Date: Wed, 10 Nov 2010 13:01:41 -0800 Subject: ospf6d: Have ospf6d cleanup when it terminates normally A clean exit makes it easier to use memory debuggers. * ospf6_asbr.c: (ospf6_asbr_terminate) Add a function to do route map cleanup. * ospf6_lsa.c: (ospf6_lsa_terminate) Add a function to cleanup the lsa handler vector. * ospf6_main.c: (ospf6_exit) Add an function that causes ospf6d to gracefully exit. * ospf6_message.c: (ospf6_message_terminate) Add a function that frees the send and receive buffers. * ospf6_top.c: (ospf6_delete) Enable the ospf6_delete() function. Disable ospf6 before freeing everything. Signed-off-by: Vyacheslav Trushkin Conflicts: ospf6d/ospf6_lsa.h --- ospf6d/ospf6_message.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'ospf6d/ospf6_message.c') diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 8179fc14..aaee4d20 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -1504,6 +1504,24 @@ ospf6_iobuf_size (unsigned int size) return iobuflen; } +void +ospf6_message_terminate (void) +{ + if (recvbuf) + { + XFREE (MTYPE_OSPF6_MESSAGE, recvbuf); + recvbuf = NULL; + } + + if (sendbuf) + { + XFREE (MTYPE_OSPF6_MESSAGE, sendbuf); + sendbuf = NULL; + } + + iobuflen = 0; +} + int ospf6_receive (struct thread *thread) { -- cgit v1.2.1