summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/app_minivm.c6
-rw-r--r--apps/app_page.c1
-rw-r--r--apps/app_queue.c9
-rw-r--r--apps/app_record.c8
-rw-r--r--apps/app_voicemail.c47
5 files changed, 52 insertions, 19 deletions
diff --git a/apps/app_minivm.c b/apps/app_minivm.c
index eca7f307c..0b463114b 100644
--- a/apps/app_minivm.c
+++ b/apps/app_minivm.c
@@ -1255,6 +1255,8 @@ static int sendmail(struct minivm_template *template, struct minivm_account *vmu
if (ast_strlen_zero(email)) {
ast_log(LOG_WARNING, "No address to send message to.\n");
+ ast_free(str1);
+ ast_free(str2);
return -1;
}
@@ -1309,11 +1311,15 @@ static int sendmail(struct minivm_template *template, struct minivm_account *vmu
}
if (!p) {
ast_log(LOG_WARNING, "Unable to open temporary file '%s'\n", tmp);
+ ast_free(str1);
+ ast_free(str2);
return -1;
}
/* Allocate channel used for chanvar substitution */
ast = ast_dummy_channel_alloc();
if (!ast) {
+ ast_free(str1);
+ ast_free(str2);
return -1;
}
diff --git a/apps/app_page.c b/apps/app_page.c
index 61172fc8e..8c5694841 100644
--- a/apps/app_page.c
+++ b/apps/app_page.c
@@ -270,6 +270,7 @@ static int page_exec(struct ast_channel *chan, const char *data)
/* Append technology and resource */
if (ast_dial_append(dial, tech, resource) == -1) {
ast_log(LOG_ERROR, "Failed to add %s to outbound dial\n", tech);
+ ast_dial_destroy(dial);
continue;
}
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 151f03cd4..a566c9aed 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1973,9 +1973,17 @@ static int insert_penaltychange(const char *list_name, const char *content, cons
if (!inserted) {
AST_LIST_INSERT_TAIL(&rl_iter->rules, rule, list);
+ inserted = 1;
}
+
+ break;
}
+ if (!inserted) {
+ ast_log(LOG_WARNING, "Unknown rule list name %s; ignoring.\n", list_name);
+ ast_free(rule);
+ return -1;
+ }
return 0;
}
@@ -4538,6 +4546,7 @@ static struct ast_datastore *setup_transfer_datastore(struct queue_ent *qe, stru
ast_channel_lock(qe->chan);
if (!(ds = ast_datastore_alloc(&queue_transfer_info, NULL))) {
ast_channel_unlock(qe->chan);
+ ast_free(qtds);
ast_log(LOG_WARNING, "Unable to create transfer datastore. queue_log will not show attended transfer\n");
return NULL;
}
diff --git a/apps/app_record.c b/apps/app_record.c
index 3499cb118..ff233d6a9 100644
--- a/apps/app_record.c
+++ b/apps/app_record.c
@@ -415,12 +415,14 @@ static int record_exec(struct ast_channel *chan, const char *data)
out:
if ((silence > 0) && rfmt.id) {
res = ast_set_read_format(chan, &rfmt);
- if (res)
+ if (res) {
ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", ast_channel_name(chan));
- if (sildet)
- ast_dsp_free(sildet);
+ }
}
+ if (sildet) {
+ ast_dsp_free(sildet);
+ }
return res;
}
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 7e75ea9a9..eec08a484 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -11728,16 +11728,22 @@ static int handle_subscribe(void *datap)
static void mwi_unsub_event_cb(const struct ast_event *event, void *userdata)
{
uint32_t u, *uniqueid = ast_calloc(1, sizeof(*uniqueid));
- if (ast_event_get_type(event) != AST_EVENT_UNSUB)
+
+ if (!uniqueid) {
+ ast_log(LOG_ERROR, "Unable to allocate memory for uniqueid\n");
return;
+ }
- if (ast_event_get_ie_uint(event, AST_EVENT_IE_EVENTTYPE) != AST_EVENT_MWI)
+ if (ast_event_get_type(event) != AST_EVENT_UNSUB) {
+ ast_free(uniqueid);
return;
+ }
- if (!uniqueid) {
- ast_log(LOG_ERROR, "Unable to allocate memory for uniqueid\n");
+ if (ast_event_get_ie_uint(event, AST_EVENT_IE_EVENTTYPE) != AST_EVENT_MWI) {
+ ast_free(uniqueid);
return;
}
+
u = ast_event_get_ie_uint(event, AST_EVENT_IE_UNIQUEID);
*uniqueid = u;
if (ast_taskprocessor_push(mwi_subscription_tps, handle_unsubscribe, uniqueid) < 0) {
@@ -12728,8 +12734,10 @@ static void read_password_from_file(const char *secretfn, char *password, int pa
const char *val = ast_variable_retrieve(pwconf, "general", "password");
if (val) {
ast_copy_string(password, val, passwordlen);
- return;
+ ast_config_destroy(pwconf);
+ return;
}
+ ast_config_destroy(pwconf);
}
ast_log(LOG_NOTICE, "Failed reading voicemail password from %s, using secret from config file\n", secretfn);
}
@@ -12738,26 +12746,33 @@ static int write_password_to_file(const char *secretfn, const char *password) {
struct ast_config *conf;
struct ast_category *cat;
struct ast_variable *var;
+ int res = -1;
- if (!(conf=ast_config_new())) {
+ if (!(conf = ast_config_new())) {
ast_log(LOG_ERROR, "Error creating new config structure\n");
- return -1;
+ return res;
}
- if (!(cat=ast_category_new("general","",1))) {
+ if (!(cat = ast_category_new("general", "", 1))) {
ast_log(LOG_ERROR, "Error creating new category structure\n");
- return -1;
+ ast_config_destroy(conf);
+ return res;
}
- if (!(var=ast_variable_new("password",password,""))) {
+ if (!(var = ast_variable_new("password", password, ""))) {
ast_log(LOG_ERROR, "Error creating new variable structure\n");
- return -1;
+ ast_config_destroy(conf);
+ ast_category_destroy(cat);
+ return res;
}
- ast_category_append(conf,cat);
- ast_variable_append(cat,var);
- if (ast_config_text_file_save(secretfn, conf, "app_voicemail")) {
+ ast_category_append(conf, cat);
+ ast_variable_append(cat, var);
+ if (!ast_config_text_file_save(secretfn, conf, "app_voicemail")) {
+ res = 0;
+ } else {
ast_log(LOG_ERROR, "Error writing voicemail password to %s\n", secretfn);
- return -1;
}
- return 0;
+
+ ast_config_destroy(conf);
+ return res;
}
static int vmsayname_exec(struct ast_channel *chan, const char *data)