From: Chris Rienzo Date: Sat, 27 Apr 2019 01:26:37 +0000 (-0400) Subject: FS-11781 [test] Fix memory leak in test X-Git-Tag: v1.10.0~287 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4f1af83e87cfc11506e1dad4d59eb9f90327c8a;p=thirdparty%2Ffreeswitch.git FS-11781 [test] Fix memory leak in test --- diff --git a/src/include/test/switch_test.h b/src/include/test/switch_test.h index b809e67228..8c9a970217 100644 --- a/src/include/test/switch_test.h +++ b/src/include/test/switch_test.h @@ -387,16 +387,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char /** * Define the test suite setup. This is run before each test or session test. */ -#define FST_SETUP_BEGIN() \ - FCT_SETUP_BGN() \ - if (fst_core) { \ - switch_core_new_memory_pool(&fst_pool); \ - fst_requires(fst_pool != NULL); \ - if (fst_core > 1) { \ - fst_requires(switch_core_timer_init(&fst_timer, "soft", 20, 160, fst_pool) == SWITCH_STATUS_SUCCESS); \ - } \ - fst_time_mark(); \ - } +#define FST_SETUP_BEGIN FCT_SETUP_BGN /** * Define the end of test suite setup. @@ -430,6 +421,14 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char */ #define FST_TEST_BEGIN(name) \ FCT_TEST_BGN(name) \ + if (fst_core) { \ + switch_core_new_memory_pool(&fst_pool); \ + fst_requires(fst_pool != NULL); \ + if (fst_core > 1) { \ + fst_requires(switch_core_timer_init(&fst_timer, "soft", 20, 160, fst_pool) == SWITCH_STATUS_SUCCESS); \ + } \ + fst_time_mark(); \ + } \ if (fst_test_module) { \ fst_requires_module(fst_test_module); \ } @@ -459,6 +458,16 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char #define FST_SESSION_BEGIN_RATE(name, rate) \ FCT_TEST_BGN(name) \ + { \ + if (fst_core) { \ + switch_core_new_memory_pool(&fst_pool); \ + fst_requires(fst_pool != NULL); \ + if (fst_core > 1) { \ + fst_requires(switch_core_timer_init(&fst_timer, "soft", 20, 160, fst_pool) == SWITCH_STATUS_SUCCESS); \ + } \ + fst_time_mark(); \ + } \ + } \ { \ switch_core_session_t *fst_session = NULL; \ switch_event_t *fst_originate_vars = NULL; \