[asterisk-commits] file: trunk r42373 - /trunk/apps/app_voicemail.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Sep 7 19:00:45 MST 2006


Author: file
Date: Thu Sep  7 21:00:45 2006
New Revision: 42373

URL: http://svn.digium.com/view/asterisk?rev=42373&view=rev
Log:
Destroy msg_cfg after it's used, not before (issue #7618 reported by wvolz with minor mods)

Modified:
    trunk/apps/app_voicemail.c

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?rev=42373&r1=42372&r2=42373&view=diff
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Thu Sep  7 21:00:45 2006
@@ -7504,7 +7504,6 @@
 	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);
 #endif
 	switch (option) {
 	case 3:
@@ -7528,8 +7527,10 @@
 				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';
 				}
@@ -7539,13 +7540,16 @@
 				/* 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';
@@ -7613,6 +7617,7 @@
 				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)) {
@@ -7628,6 +7633,7 @@
 				res = leave_voicemail(chan, mailbox, &leave_options);
 				if (!res)
 					res = 't';
+				ast_config_destroy(msg_cfg);
 				return res;
 			} else {
 				/* Sender has no mailbox, can't reply */
@@ -7635,6 +7641,7 @@
 					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");
 				res = 't';
+				ast_config_destroy(msg_cfg);
 				return res;
 			}
 		} 



More information about the asterisk-commits mailing list