--- asterisk-11.3.0.o/apps/app_voicemail.c 2013-03-27 16:07:16.000000000 +0200 +++ asterisk-11.3.0/apps/app_voicemail.c 2013-04-03 20:57:04.172329542 +0200 @@ -1742,8 +1742,10 @@ reset_user_pw(vmu->context, vmu->mailbox, newpassword); ast_copy_string(vmu->password, newpassword, sizeof(vmu->password)); ast_config_text_file_save(VOICEMAIL_CONFIG, cfg, "AppVoicemail"); + ast_config_destroy(cfg); break; } + ast_config_destroy(cfg); } /* Fall-through */ case OPT_PWLOC_USERSCONF: @@ -1783,6 +1785,7 @@ ast_copy_string(vmu->password, newpassword, sizeof(vmu->password)); ast_config_text_file_save("users.conf", cfg, "AppVoicemail"); } + ast_config_destroy(cfg); } } } @@ -4193,7 +4196,7 @@ if (obj) { ast_odbc_release_obj(obj); } - if (cfg) + if (cfg && cfg != CONFIG_STATUS_FILEINVALID) ast_config_destroy(cfg); if (fdm != MAP_FAILED) munmap(fdm, fdlen); @@ -4672,7 +4675,7 @@ if (strlen(fromfile) < sizeof(fromfile) - 5) { strcat(fromfile, ".txt"); } - if (!(msg_cfg = ast_config_load(fromfile, config_flags))) { + if (!(msg_cfg = ast_config_load(fromfile, config_flags)) || msg_cfg == CONFIG_STATUS_FILEINVALID) { ast_debug(1, "Config load for message text file '%s' failed\n", fromfile); return; } @@ -5064,7 +5067,7 @@ if (strlen(fromfile) < sizeof(fromfile) - 5) { strcat(fromfile, ".txt"); } - if ((msg_cfg = ast_config_load(fromfile, config_flags))) { + if ((msg_cfg = ast_config_load(fromfile, config_flags)) && msg_cfg != CONFIG_STATUS_FILEINVALID) { if ((v = ast_variable_retrieve(msg_cfg, "message", "callerid"))) { ast_copy_string(origcallerid, v, sizeof(origcallerid)); } @@ -7583,7 +7586,7 @@ *duration = 0; /* if we can't read the message metadata, stop now */ - if (!msg_cfg) { + if (!msg_cfg || msg_cfg == CONFIG_STATUS_FILEINVALID) { cmd = 0; break; } @@ -7667,7 +7670,7 @@ } } - if (msg_cfg) + if (msg_cfg && msg_cfg != CONFIG_STATUS_FILEINVALID) ast_config_destroy(msg_cfg); if (prepend_duration) *duration = prepend_duration; @@ -13562,7 +13565,7 @@ struct ast_flags config_flags = { 0 }; pwconf = ast_config_load(secretfn, config_flags); - if (pwconf) { + if (pwconf && pwconf != CONFIG_STATUS_FILEINVALID) { const char *val = ast_variable_retrieve(pwconf, "general", "password"); if (val) { ast_copy_string(password, val, passwordlen); @@ -14049,7 +14052,7 @@ fputs("00000002 => 9999,Mrs. Test\n", file); fclose(file); - if (!(cfg = ast_config_load(config_filename, config_flags))) { + if (!(cfg = ast_config_load(config_filename, config_flags)) || cfg == CONFIG_STATUS_FILEINVALID) { res = AST_TEST_FAIL; goto cleanup; } @@ -14529,9 +14532,9 @@ break; } -#ifndef IMAP_STORAGE ast_config_destroy(msg_cfg); +#ifndef IMAP_STORAGE if (!res) { make_file(vms->fn, sizeof(vms->fn), vms->curdir, msg); vms->heard[msg] = 1;