From 73c8b06dcc504e9842222b8e69b9c6f02870a47d Mon Sep 17 00:00:00 2001 From: Luigi Rizzo Date: Fri, 21 Apr 2006 11:19:48 +0000 Subject: localize a variable, and make a minor code rearrangement. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@21850 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- pbx.c | 10 ++++++---- 1 file 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; -- cgit v1.2.3