Skip to content

Commit

Permalink
*: make all daemons call frr_fini() on exit
Browse files Browse the repository at this point in the history
This allow us to find real leaks more easily with tools like valgrind.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
  • Loading branch information
rwestphal committed Sep 12, 2017
1 parent 953d97f commit 8879bd2
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions babeld/babel_main.c
Expand Up @@ -335,6 +335,7 @@ babel_exit_properly(void)
babel_save_state_file();
debugf(BABEL_DEBUG_COMMON, "Remove pid file.");
debugf(BABEL_DEBUG_COMMON, "Done.");
frr_fini();

exit(0);
}
Expand Down
7 changes: 3 additions & 4 deletions eigrpd/eigrpd.c
Expand Up @@ -42,6 +42,7 @@
#include "plist.h"
#include "sockopt.h"
#include "keychain.h"
#include "libfrr.h"

#include "eigrpd/eigrp_structs.h"
#include "eigrpd/eigrpd.h"
Expand Down Expand Up @@ -241,12 +242,10 @@ void eigrp_terminate(void)

SET_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN);

/* exit immediately if EIGRP not actually running */
if (listcount(eigrp_om->eigrp) == 0)
exit(0);

for (ALL_LIST_ELEMENTS(eigrp_om->eigrp, node, nnode, eigrp))
eigrp_finish(eigrp);

frr_fini();
}

void eigrp_finish(struct eigrp *eigrp)
Expand Down
2 changes: 2 additions & 0 deletions isisd/isis_zebra.c
Expand Up @@ -35,6 +35,7 @@
#include "linklist.h"
#include "nexthop.h"
#include "vrf.h"
#include "libfrr.h"

#include "isisd/dict.h"
#include "isisd/isis_constants.h"
Expand Down Expand Up @@ -427,4 +428,5 @@ void isis_zebra_stop(void)
{
zclient_stop(zclient);
zclient_free(zclient);
frr_fini();
}
3 changes: 3 additions & 0 deletions ospfd/ospfd.c
Expand Up @@ -35,6 +35,7 @@
#include "plist.h"
#include "sockopt.h"
#include "bfd.h"
#include "libfrr.h"
#include "defaults.h"

#include "ospfd/ospfd.h"
Expand Down Expand Up @@ -489,6 +490,8 @@ void ospf_terminate(void)
*/
zclient_stop(zclient);
zclient_free(zclient);

frr_fini();
}

void ospf_finish(struct ospf *ospf)
Expand Down
2 changes: 2 additions & 0 deletions pimd/pimd.c
Expand Up @@ -139,4 +139,6 @@ void pim_terminate()
zclient_stop(zclient);
zclient_free(zclient);
}

frr_fini();
}
1 change: 1 addition & 0 deletions ripd/rip_main.c
Expand Up @@ -89,6 +89,7 @@ static void sigint(void)
rip_clean();

rip_zclient_stop();
frr_fini();

exit(0);
}
Expand Down
1 change: 1 addition & 0 deletions ripngd/ripng_main.c
Expand Up @@ -92,6 +92,7 @@ static void sigint(void)
ripng_clean();

ripng_zebra_stop();
frr_fini();
exit(0);
}

Expand Down

0 comments on commit 8879bd2

Please sign in to comment.