summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2015-06-09 06:57:53 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-06-09 06:57:53 -0500
commitbbeb753e5ed21f6a21242a24092b0d71d9d6c75c (patch)
treeab76f427f421f3eab6b3b9f977217fee532d5e18 /tests
parent53c1126090733d8d4e6ee06e2ef92dc98bb0f374 (diff)
parent80621ce3c5da5062f7e3efb42d6e8fcdd9caa3f6 (diff)
Merge "Fix unsafe uses of ast_context pointers."
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gosub.c10
-rw-r--r--tests/test_pbx.c9
2 files changed, 7 insertions, 12 deletions
diff --git a/tests/test_gosub.c b/tests/test_gosub.c
index c4b071ee2..e0f618cd5 100644
--- a/tests/test_gosub.c
+++ b/tests/test_gosub.c
@@ -42,10 +42,10 @@ ASTERISK_REGISTER_FILE()
AST_TEST_DEFINE(test_gosub)
{
+#define CONTEXT_NAME "tests_test_gosub_virtual_context"
int res = AST_TEST_PASS, i;
struct ast_channel *chan;
struct ast_str *str;
- struct ast_context *con;
struct testplan {
const char *app;
const char *args;
@@ -119,14 +119,14 @@ AST_TEST_DEFINE(test_gosub)
}
/* Create our test dialplan */
- if (!(con = ast_context_find_or_create(NULL, NULL, "tests_test_gosub_virtual_context", "test_gosub"))) {
+ if (!ast_context_find_or_create(NULL, NULL, CONTEXT_NAME, "test_gosub")) {
ast_test_status_update(test, "Unable to create test dialplan context");
ast_free(str);
ast_channel_unref(chan);
return AST_TEST_FAIL;
}
- ast_add_extension2(con, 1, "s", 1, NULL, NULL, "NoOp", ast_strdup(""), ast_free_ptr, "test_gosub");
+ ast_add_extension(CONTEXT_NAME, 1, "s", 1, NULL, NULL, "NoOp", ast_strdup(""), ast_free_ptr, "test_gosub");
for (i = 0; i < ARRAY_LEN(testplan); i++) {
if (testplan[i].app == NULL) {
@@ -157,8 +157,8 @@ AST_TEST_DEFINE(test_gosub)
ast_free(str);
ast_channel_unref(chan);
- ast_context_remove_extension2(con, "s", 1, NULL, 0);
- ast_context_destroy(con, "test_gosub");
+ ast_context_remove_extension(CONTEXT_NAME, "s", 1, NULL);
+ ast_context_destroy(NULL, "test_gosub");
return res;
}
diff --git a/tests/test_pbx.c b/tests/test_pbx.c
index 388baa3f5..88451672d 100644
--- a/tests/test_pbx.c
+++ b/tests/test_pbx.c
@@ -198,7 +198,6 @@ AST_TEST_DEFINE(pattern_match_test)
*/
struct {
const char * context_string;
- struct ast_context *context;
} contexts[] = {
{ TEST_PATTERN, },
{ TEST_PATTERN_INCLUDE, },
@@ -267,7 +266,7 @@ AST_TEST_DEFINE(pattern_match_test)
*/
for (i = 0; i < ARRAY_LEN(contexts); ++i) {
- if (!(contexts[i].context = ast_context_find_or_create(NULL, NULL, contexts[i].context_string, registrar))) {
+ if (!ast_context_find_or_create(NULL, NULL, contexts[i].context_string, registrar)) {
ast_test_status_update(test, "Failed to create context %s\n", contexts[i].context_string);
res = AST_TEST_FAIL;
goto cleanup;
@@ -319,11 +318,7 @@ AST_TEST_DEFINE(pattern_match_test)
}
cleanup:
- for (i = 0; i < ARRAY_LEN(contexts); ++i) {
- if (contexts[i].context) {
- ast_context_destroy(contexts[i].context, registrar);
- }
- }
+ ast_context_destroy(NULL, registrar);
return res;
}