summaryrefslogtreecommitdiff
path: root/main/pbx.c
diff options
context:
space:
mode:
authorMatthew Nicholson <mnicholson@digium.com>2011-09-13 18:49:26 +0000
committerMatthew Nicholson <mnicholson@digium.com>2011-09-13 18:49:26 +0000
commitb292ff3b326cfaac9fd4846c6e34198dd50492e8 (patch)
tree505f4fc137f8f09b5e7a623d71400553c7027b14 /main/pbx.c
parent2e2381341e7968d9392c145a50bd8134b08148ad (diff)
Merged revisions 335653 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10 ................ r335653 | mnicholson | 2011-09-13 13:47:57 -0500 (Tue, 13 Sep 2011) | 12 lines Merged revisions 335618 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r335618 | mnicholson | 2011-09-13 13:20:52 -0500 (Tue, 13 Sep 2011) | 5 lines Don't limit the size of appdata for manager originate actions. ASTERISK-17709 Patch by: tilghman (with modifications) ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@335654 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/pbx.c')
-rw-r--r--main/pbx.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/main/pbx.c b/main/pbx.c
index 5b33f3a72..e67458b65 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -8905,10 +8905,12 @@ outgoing_exten_cleanup:
}
struct app_tmp {
- char app[256];
- char data[256];
struct ast_channel *chan;
pthread_t t;
+ AST_DECLARE_STRING_FIELDS (
+ AST_STRING_FIELD(app);
+ AST_STRING_FIELD(data);
+ );
};
/*! \brief run the application and free the descriptor once done */
@@ -8923,6 +8925,7 @@ static void *ast_pbx_run_app(void *data)
} else
ast_log(LOG_WARNING, "No such application '%s'\n", tmp->app);
ast_hangup(tmp->chan);
+ ast_string_field_free_memory(tmp);
ast_free(tmp);
return NULL;
}
@@ -8954,12 +8957,14 @@ int ast_pbx_outgoing_app(const char *type, struct ast_format_cap *cap, void *dat
res = 0;
ast_verb(4, "Channel %s was answered.\n", chan->name);
tmp = ast_calloc(1, sizeof(*tmp));
- if (!tmp)
+ if (!tmp || ast_string_field_init(tmp, 252)) {
+ if (tmp) {
+ ast_free(tmp);
+ }
res = -1;
- else {
- ast_copy_string(tmp->app, app, sizeof(tmp->app));
- if (appdata)
- ast_copy_string(tmp->data, appdata, sizeof(tmp->data));
+ } else {
+ ast_string_field_set(tmp, app, app);
+ ast_string_field_set(tmp, data, appdata);
tmp->chan = chan;
if (synchronous > 1) {
if (locked_channel)
@@ -8970,6 +8975,7 @@ int ast_pbx_outgoing_app(const char *type, struct ast_format_cap *cap, void *dat
ast_channel_lock(chan);
if (ast_pthread_create_detached(&tmp->t, NULL, ast_pbx_run_app, tmp)) {
ast_log(LOG_WARNING, "Unable to spawn execute thread on %s: %s\n", chan->name, strerror(errno));
+ ast_string_field_free_memory(tmp);
ast_free(tmp);
if (locked_channel)
ast_channel_unlock(chan);