diff --git a/daemon/graphite.c b/daemon/graphite.c index a72811395..281784b8a 100644 --- a/daemon/graphite.c +++ b/daemon/graphite.c @@ -39,7 +39,11 @@ void set_graphite_interval_tv(struct timeval *tv) { } void set_prefix(char* prefix) { - graphite_prefix = prefix; + graphite_prefix = g_strdup(prefix); +} + +void free_prefix(void) { + g_free(graphite_prefix); } static struct requests_ps clear_requests_per_second(struct requests_ps *requests) { diff --git a/daemon/main.c b/daemon/main.c index e80bf72ba..59504bb29 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -960,6 +960,8 @@ int main(int argc, char **argv) { ilog(LOG_INFO, "Version %s shutting down", RTPENGINE_VERSION); + recording_fs_free(); + unfill_initial_rtpe_cfg(&initial_rtpe_config); call_free(); @@ -977,6 +979,8 @@ int main(int argc, char **argv) { redis_close(rtpe_redis_write); redis_close(rtpe_redis_notify); + free_prefix(); + options_free(); log_free(); diff --git a/daemon/recording.c b/daemon/recording.c index a3fe945f1..d14ca1d67 100644 --- a/daemon/recording.c +++ b/daemon/recording.c @@ -113,6 +113,18 @@ static const struct pcap_format *pcap_format; +/** + * Free RTP Engine filesystem settings and structure. + * Check for and free the RTP Engine spool directory. + */ + +void recording_fs_free(void) { + if (spooldir) + free(spooldir); + + spooldir = NULL; +} + /** * Initialize RTP Engine filesystem settings and structure. * Check for or create the RTP Engine spool directory. diff --git a/daemon/redis.c b/daemon/redis.c index a0c2a1ece..ce857d8a7 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -1768,6 +1768,9 @@ int redis_restore(struct redis *r) { g_thread_pool_push(gtp, call, NULL); } + g_thread_pool_stop_unused_threads(); + g_thread_pool_set_max_unused_threads(0); + g_thread_pool_free(gtp, FALSE, TRUE); while ((r = g_queue_pop_head(&ctx.r_q))) redis_close(r); diff --git a/include/graphite.h b/include/graphite.h index e2eb712e3..4620c1872 100644 --- a/include/graphite.h +++ b/include/graphite.h @@ -19,6 +19,7 @@ enum connection_state { extern struct timeval rtpe_latest_graphite_interval_start; void set_prefix(char* prefix); +void free_prefix(void); void graphite_loop(void *d); void set_latest_graphite_interval_start(struct timeval *tv); void set_graphite_interval_tv(struct timeval *tv); diff --git a/include/recording.h b/include/recording.h index 5382139cb..c3e7dec78 100644 --- a/include/recording.h +++ b/include/recording.h @@ -101,6 +101,7 @@ extern const struct recording_method *selected_recording_method; * Check for or create the RTP Engine spool directory. */ void recording_fs_init(const char *spooldir, const char *method, const char *format); +void recording_fs_free(void); /** diff --git a/recording-daemon/main.c b/recording-daemon/main.c index c81357bf7..3d56cb6d0 100644 --- a/recording-daemon/main.c +++ b/recording-daemon/main.c @@ -194,6 +194,7 @@ static void options(int *argc, char ***argv) { //the daemon has no function die("Both output and forwarding are disabled"); } + g_free(output_format); output_format = NULL; } else if (!output_mixed && !output_single) output_mixed = output_single = 1; @@ -250,7 +251,12 @@ int main(int argc, char **argv) { wait_threads_finish(); + if (decoding_enabled) + codeclib_free(); + options_free(); + log_free(); + cleanup(); }