aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-25 16:26:08 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-25 16:26:08 +0000
commit3aa22466c561b813257cc18a1e6a23b92668d8fc (patch)
tree9f70c7e410de159ec46d74dfc57c842ad2059b57 /apps
parentda75f62dc0564e1162c5ecd5da55053706534b62 (diff)
Merged revisions 114651 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r114651 | mmichelson | 2008-04-25 11:25:17 -0500 (Fri, 25 Apr 2008) | 4 lines Fix a memory leak and protect against potential dereferences of a NULL pointer. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@114652 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_voicemail.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index ed2e61e50..423b95780 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -4089,11 +4089,11 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu,
strncat(textfile, ".txt", sizeof(textfile) - strlen(textfile) - 1);
strncat(backup, "-bak", sizeof(backup) - strlen(backup) - 1);
- msg_cfg = ast_config_load(textfile, config_flags);
-
- *duration = 0;
- if ((duration_str = ast_variable_retrieve(msg_cfg, "message", "duration")))
+ if ((msg_cfg = ast_config_load(textfile, config_flags)) && (duration_str = ast_variable_retrieve(msg_cfg, "message", "duration"))) {
*duration = atoi(duration_str);
+ } else {
+ *duration = 0;
+ }
while ((cmd >= 0) && (cmd != 't') && (cmd != '*')) {
if (cmd)
@@ -4104,7 +4104,7 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu,
prepend_duration = 0;
/* if we can't read the message metadata, stop now */
- if (!(msg_cfg = ast_config_load(textfile, config_flags))) {
+ if (!msg_cfg) {
cmd = 0;
break;
}
@@ -4159,7 +4159,8 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu,
}
}
- ast_config_destroy(msg_cfg);
+ if (msg_cfg)
+ ast_config_destroy(msg_cfg);
if (already_recorded)
ast_filedelete(backup, NULL);
if (prepend_duration)