]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fix various places where the code returns without unlocking vmlock or
authorRussell Bryant <russell@russellbryant.com>
Tue, 13 Jun 2006 04:31:19 +0000 (04:31 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 13 Jun 2006 04:31:19 +0000 (04:31 +0000)
destroying loaded configuration

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@33783 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c

index b61b54d625e612dad9d081673d1f4e06831f1398..c08a563e8e34e11be7cd491e60665a1590c5deb6 100644 (file)
@@ -6172,10 +6172,14 @@ static int load_config(void)
                                                        } else {
                                                                ast_log(LOG_WARNING, "Out of memory while reading voicemail config\n");
                                                                free(z);
+                                                               ast_mutex_unlock(&vmlock);
+                                                               ast_config_destroy(cfg);
                                                                return -1;
                                                        }
                                                } else {
                                                        ast_log(LOG_WARNING, "Out of memory while reading voicemail config\n");
+                                                       ast_mutex_unlock(&vmlock);
+                                                       ast_config_destroy(cfg);
                                                        return -1;
                                                }
                                                var = var->next;
@@ -6435,8 +6439,10 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
                return 0;
        }
 
-       if (!(origtime = ast_variable_retrieve(msg_cfg, "message", "origtime")))
+       if (!(origtime = ast_variable_retrieve(msg_cfg, "message", "origtime"))) {
+               ast_config_destroy(msg_cfg);
                return 0;
+       }
 
        cid = ast_variable_retrieve(msg_cfg, "message", "callerid");
 
@@ -6444,6 +6450,8 @@ 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)
@@ -6576,8 +6584,6 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
                }
        }
 
-       ast_config_destroy(msg_cfg);
-
        if (!res) {
                make_file(vms->fn, sizeof(vms->fn), vms->curdir, msg);
                vms->heard[msg] = 1;