[asterisk-commits] Correct some leaks in unit tests. (asterisk[13])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Aug 4 11:01:37 CDT 2017
Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6151 )
Change subject: Correct some leaks in unit tests.
......................................................................
Correct some leaks in unit tests.
* chan_sip: channel in test_sip_rtpqos_1.
* test_config: config hook, config info and global config holder.
* test_core_format: format in format_attribute_set_without_interface.
* test_stream: unneeded frame duplication.
* test_taskprocessor: task_data.
Change-Id: I94d364d195cf3b3b5de2bf3ad565343275c7ad31
---
M channels/sip/dialplan_functions.c
M tests/test_config.c
M tests/test_core_format.c
M tests/test_taskprocessor.c
4 files changed, 11 insertions(+), 2 deletions(-)
Approvals:
Sean Bright: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
diff --git a/channels/sip/dialplan_functions.c b/channels/sip/dialplan_functions.c
index b859c60..af443fd 100644
--- a/channels/sip/dialplan_functions.c
+++ b/channels/sip/dialplan_functions.c
@@ -486,6 +486,9 @@
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 602c3e7..8fb4735 100644
--- a/tests/test_config.c
+++ b/tests/test_config.c
@@ -1040,6 +1040,7 @@
res = AST_TEST_PASS;
out:
+ ast_config_hook_unregister("test_hook");
delete_config_file();
return res;
}
@@ -1677,6 +1678,8 @@
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 a3819c6..e4199db 100644
--- a/tests/test_core_format.c
+++ b/tests/test_core_format.c
@@ -860,6 +860,7 @@
{
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:
@@ -885,10 +886,12 @@
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_taskprocessor.c b/tests/test_taskprocessor.c
index be48f92..ad2074c 100644
--- a/tests/test_taskprocessor.c
+++ b/tests/test_taskprocessor.c
@@ -677,7 +677,7 @@
{
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;
--
To view, visit https://gerrit.asterisk.org/6151
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I94d364d195cf3b3b5de2bf3ad565343275c7ad31
Gerrit-Change-Number: 6151
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170804/b123e152/attachment-0001.html>
More information about the asterisk-commits
mailing list