aboutsummaryrefslogtreecommitdiffstats
path: root/main/pbx.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-13 00:13:43 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-13 00:13:43 +0000
commit177ddeb1bd1f6a78505d0cf570c2cde8ba28dfee (patch)
treef37b70c464b220c367f37cfb491ae9503d6a72a5 /main/pbx.c
parente496282bb828fd7af63d69f5161223a3c72c05c2 (diff)
Two fixes found while debugging with ast_backtrace():
1) If MALLOC_DEBUG is used when concurrently using ast_backtrace, the free() used in that routine will trigger an error, because the memory was allocated internally to libc, where we could not intercept that call to wrap it. Therefore, it's not memory we knew about, and the free is reported as an error. 2) Now that channels are objects, the old hack of initializing a channel to all zeroes no longer works, since we may try to call something like ast_channel_lock() within a function on that reference. In that case, it's reported as an error, because the pointer isn't an object reference. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@194101 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/pbx.c')
-rw-r--r--main/pbx.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/main/pbx.c b/main/pbx.c
index d5f4ead90..dbde400b9 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -7908,12 +7908,10 @@ static int ast_add_extension2_lockopt(struct ast_context *con,
/* If we are adding a hint evalulate in variables and global variables */
if (priority == PRIORITY_HINT && strstr(application, "${") && !strstr(extension, "_")) {
- struct ast_channel c = {0, };
-
- ast_copy_string(c.exten, extension, sizeof(c.exten));
- ast_copy_string(c.context, con->name, sizeof(c.context));
- pbx_substitute_variables_helper(&c, application, expand_buf, sizeof(expand_buf));
+ struct ast_channel *c = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", extension, con->name, 0, "Bogus/%s", __PRETTY_FUNCTION__);
+ pbx_substitute_variables_helper(c, application, expand_buf, sizeof(expand_buf));
application = expand_buf;
+ ast_channel_release(c);
}
length = sizeof(struct ast_exten);