diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-11-13 21:17:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-13 21:17:16 +0200 |
| commit | 04a587f4809e9c82a5f01dfb8b61f3430b45c69b (patch) | |
| tree | 972d078bc2cef1af065f02787dcb6b4400feef21 /sharpd/sharp_main.c | |
| parent | c62c0181f07241fa3beb0a3aec3c39401ed8e5c7 (diff) | |
| parent | 3edeaa906660c60d2ecfc3f9f107f420bfacdf30 (diff) | |
Merge pull request #14781 from donaldsharp/frr_memory_leaks_cleanup
Frr memory leaks cleanup
Diffstat (limited to 'sharpd/sharp_main.c')
| -rw-r--r-- | sharpd/sharp_main.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/sharpd/sharp_main.c b/sharpd/sharp_main.c index fa85c2b448..0cbed5579d 100644 --- a/sharpd/sharp_main.c +++ b/sharpd/sharp_main.c @@ -54,6 +54,22 @@ struct zebra_privs_t sharp_privs = { struct option longopts[] = {{0}}; +struct sharp_global sg; + +static void sharp_global_init(void) +{ + memset(&sg, 0, sizeof(sg)); + sg.nhs = list_new(); + sg.ted = NULL; + sg.srv6_locators = list_new(); +} + +static void sharp_global_destroy(void) +{ + list_delete(&sg.nhs); + list_delete(&sg.srv6_locators); +} + /* Master of threads. */ struct event_loop *master; @@ -68,6 +84,11 @@ static void sigint(void) { zlog_notice("Terminating on signal"); + vrf_terminate(); + sharp_zebra_terminate(); + + sharp_global_destroy(); + frr_fini(); exit(0); @@ -118,16 +139,6 @@ FRR_DAEMON_INFO(sharpd, SHARP, .vty_port = SHARP_VTY_PORT, .n_yang_modules = array_size(sharpd_yang_modules), ); -struct sharp_global sg; - -static void sharp_global_init(void) -{ - memset(&sg, 0, sizeof(sg)); - sg.nhs = list_new(); - sg.ted = NULL; - sg.srv6_locators = list_new(); -} - static void sharp_start_configuration(void) { zlog_debug("Configuration has started to be read"); |
