[asterisk-commits] branch 1.2 r33783 - /branches/1.2/apps/app_voicemail.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jun 12 21:31:20 MST 2006


Author: russell
Date: Mon Jun 12 23:31:19 2006
New Revision: 33783

URL: http://svn.digium.com/view/asterisk?rev=33783&view=rev
Log:
fix various places where the code returns without unlocking vmlock or
destroying loaded configuration

Modified:
    branches/1.2/apps/app_voicemail.c

Modified: branches/1.2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_voicemail.c?rev=33783&r1=33782&r2=33783&view=diff
==============================================================================
--- branches/1.2/apps/app_voicemail.c (original)
+++ branches/1.2/apps/app_voicemail.c Mon Jun 12 23:31:19 2006
@@ -6172,10 +6172,14 @@
 							} 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,14 +6439,18 @@
 		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");
 
 	context = ast_variable_retrieve(msg_cfg, "message", "context");
 	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) {
 
@@ -6575,8 +6583,6 @@
 			res = 0;
 		}
 	}
-
-	ast_config_destroy(msg_cfg);
 
 	if (!res) {
 		make_file(vms->fn, sizeof(vms->fn), vms->curdir, msg);



More information about the asterisk-commits mailing list