aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-13 19:51:24 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-13 19:51:24 +0000
commitbf595c22885412d5da57736da1febc4439062389 (patch)
treea24d26e86397c871d76bf3c29a78f5317a3b1828 /apps/app_voicemail.c
parent42bbda4433cfc19548544ca2f7e04796fc8f83b8 (diff)
Backport bugfix patch from 7918 to 1.2 - msg_cfg destroyed before used
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@42892 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index fa86fe173..1672144e8 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -6468,8 +6468,6 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
if (!strncasecmp("macro",context,5)) /* Macro names in contexts are useless for our needs */
context = ast_variable_retrieve(msg_cfg, "message","macrocontext");
- ast_config_destroy(msg_cfg);
-
if (option == 3) {
if (!res)
@@ -6489,8 +6487,10 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
if (num) {
/* Dial the CID number */
res = dialout(chan, vmu, num, vmu->callback);
- if (res)
+ if (res) {
+ ast_config_destroy(msg_cfg);
return 9;
+ }
} else {
res = '2';
}
@@ -6500,13 +6500,16 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
/* Want to enter a different number, can only do this if there's a dialout context for this user */
if (!ast_strlen_zero(vmu->dialout)) {
res = dialout(chan, vmu, NULL, vmu->dialout);
- if (res)
+ if (res) {
+ ast_config_destroy(msg_cfg);
return 9;
+ }
} else {
if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "Caller can not specify callback number - no dialout context available\n");
res = ast_play_and_wait(chan, "vm-sorry");
}
+ ast_config_destroy(msg_cfg);
return res;
case '*':
res = 't';
@@ -6573,6 +6576,7 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
ast_verbose(VERBOSE_PREFIX_3 "No CID number available, no reply sent\n");
if (!res)
res = ast_play_and_wait(chan, "vm-nonumber");
+ ast_config_destroy(msg_cfg);
return res;
} else {
if (find_user(NULL, vmu->context, num)) {
@@ -6586,6 +6590,7 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
memset(&leave_options, 0, sizeof(leave_options));
leave_options.record_gain = record_gain;
res = leave_voicemail(chan, mailbox, &leave_options);
+ ast_config_destroy(msg_cfg);
if (!res)
res = 't';
return res;
@@ -6594,6 +6599,7 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "No mailbox number '%s' in context '%s', no reply sent\n", num, vmu->context);
ast_play_and_wait(chan, "vm-nobox");
+ ast_config_destroy(msg_cfg);
res = 't';
return res;
}
@@ -6607,6 +6613,7 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
vms->heard[msg] = 1;
res = wait_file(chan, vms, vms->fn);
}
+ ast_config_destroy(msg_cfg);
return res;
}