diff options
author | Jenkins2 <jenkins2@gerrit.asterisk.org> | 2017-08-04 11:40:18 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-08-04 11:40:18 -0500 |
commit | 3ac2da897440635ab51ebbc1bd342fb8db8dcd67 (patch) | |
tree | 49f9f523d84c094e807da2b0cbd1e73a73889092 | |
parent | 4c7f81af6e4b4109e55a49700ce1ac3d60b9d0f0 (diff) | |
parent | 1a3e08326e3d2c3a82157e55e5f7f13c3d3af55a (diff) |
Merge "Correct some leaks in unit tests." into 15
-rw-r--r-- | channels/sip/dialplan_functions.c | 3 | ||||
-rw-r--r-- | tests/test_config.c | 3 | ||||
-rw-r--r-- | tests/test_core_format.c | 5 | ||||
-rw-r--r-- | tests/test_stream.c | 2 | ||||
-rw-r--r-- | tests/test_taskprocessor.c | 2 |
5 files changed, 12 insertions, 3 deletions
diff --git a/channels/sip/dialplan_functions.c b/channels/sip/dialplan_functions.c index e21bb2c24..59e841df4 100644 --- a/channels/sip/dialplan_functions.c +++ b/channels/sip/dialplan_functions.c @@ -484,6 +484,9 @@ done: dialog_unlink_all(p); dialog_unref(p, "Destroy test object"); } + if (chan) { + ast_channel_unref(chan); + } ast_rtp_engine_unregister(&test_engine); return res; } diff --git a/tests/test_config.c b/tests/test_config.c index d73710860..8675cb890 100644 --- a/tests/test_config.c +++ b/tests/test_config.c @@ -1038,6 +1038,7 @@ AST_TEST_DEFINE(config_hook) res = AST_TEST_PASS; out: + ast_config_hook_unregister("test_hook"); delete_config_file(); return res; } @@ -1675,6 +1676,8 @@ AST_TEST_DEFINE(config_options_test) configs.codeccapopt = NULL; ast_string_field_free_memory(&defaults); ast_string_field_free_memory(&configs); + aco_info_destroy(&cfg_info); + ao2_global_obj_release(global_obj); return res; } diff --git a/tests/test_core_format.c b/tests/test_core_format.c index a697f8e7d..164dff81f 100644 --- a/tests/test_core_format.c +++ b/tests/test_core_format.c @@ -858,6 +858,7 @@ AST_TEST_DEFINE(format_attribute_set_without_interface) { RAII_VAR(struct ast_codec *, codec, NULL, ao2_cleanup); RAII_VAR(struct ast_format *, format, NULL, ao2_cleanup); + struct ast_format *attr_set; switch (cmd) { case TEST_INIT: @@ -883,10 +884,12 @@ AST_TEST_DEFINE(format_attribute_set_without_interface) return AST_TEST_FAIL; } - if (!ast_format_attribute_set(format, "bees", "cool")) { + attr_set = ast_format_attribute_set(format, "bees", "cool"); + if (!attr_set) { ast_test_status_update(test, "Successfully set an attribute on a format without an interface\n"); return AST_TEST_FAIL; } + ao2_cleanup(attr_set); return AST_TEST_PASS; } diff --git a/tests/test_stream.c b/tests/test_stream.c index fdb988584..28983e05c 100644 --- a/tests/test_stream.c +++ b/tests/test_stream.c @@ -1522,7 +1522,7 @@ static int load_stream_readqueue(struct ast_channel *chan, int frames) } f.stream_num = pvt->frame_count % pvt->streams; f.seqno = pvt->frame_count; - ast_queue_frame(chan, ast_frdup(&f)); + ast_queue_frame(chan, &f); pvt->frame_count++; } diff --git a/tests/test_taskprocessor.c b/tests/test_taskprocessor.c index be48f9248..ad2074cb8 100644 --- a/tests/test_taskprocessor.c +++ b/tests/test_taskprocessor.c @@ -677,7 +677,7 @@ AST_TEST_DEFINE(taskprocessor_push_local) { RAII_VAR(struct ast_taskprocessor *, tps, NULL, ast_taskprocessor_unreference); - struct task_data *task_data; + RAII_VAR(struct task_data *, task_data, NULL, ao2_cleanup); int local_data; int res; |