aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-21 11:19:48 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-21 11:19:48 +0000
commitee681121340af8879819035ececf3e53426f919f (patch)
treeb8049049fec58e8dd69e7ea9c34d85cf0ea21f04
parent00c6d77ec7255def94c7109b8a429ad4925ab5e9 (diff)
localize a variable, and make a minor code rearrangement.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@21850 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--pbx.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/pbx.c b/pbx.c
index 032ff480a..4a44e3e82 100644
--- a/pbx.c
+++ b/pbx.c
@@ -4731,6 +4731,7 @@ struct app_tmp {
pthread_t t;
};
+/*! \brief run the application and free the descriptor once done */
static void *ast_pbx_run_app(void *data)
{
struct app_tmp *tmp = data;
@@ -4750,7 +4751,6 @@ static void *ast_pbx_run_app(void *data)
int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel)
{
struct ast_channel *chan;
- struct async_stat *as;
struct app_tmp *tmp;
int res = -1, cdr_res = -1;
struct outgoing_helper oh;
@@ -4790,7 +4790,10 @@ int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout,
res = 0;
if (option_verbose > 3)
ast_verbose(VERBOSE_PREFIX_4 "Channel %s was answered.\n", chan->name);
- if ((tmp = ast_calloc(1, sizeof(*tmp)))) {
+ tmp = ast_calloc(1, sizeof(*tmp));
+ if (!tmp)
+ res = -1;
+ else {
ast_copy_string(tmp->app, app, sizeof(tmp->app));
if (appdata)
ast_copy_string(tmp->data, appdata, sizeof(tmp->data));
@@ -4816,8 +4819,6 @@ int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout,
*locked_channel = chan;
}
}
- } else {
- res = -1;
}
} else {
if (option_verbose > 3)
@@ -4844,6 +4845,7 @@ int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout,
}
} else {
+ struct async_stat *as;
if (!(as = ast_calloc(1, sizeof(*as)))) {
res = -1;
goto outgoing_app_cleanup;