[asterisk-commits] mmichelson: branch 1.6.0 r114652 - in /branches/1.6.0: ./ apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 25 11:26:08 CDT 2008


Author: mmichelson
Date: Fri Apr 25 11:26:08 2008
New Revision: 114652

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114652
Log:
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.


........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_voicemail.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_voicemail.c?view=diff&rev=114652&r1=114651&r2=114652
==============================================================================
--- branches/1.6.0/apps/app_voicemail.c (original)
+++ branches/1.6.0/apps/app_voicemail.c Fri Apr 25 11:26:08 2008
@@ -4089,11 +4089,11 @@
 	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 @@
 			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 @@
 		}
 	}
 
-	ast_config_destroy(msg_cfg);
+	if (msg_cfg)
+		ast_config_destroy(msg_cfg);
 	if (already_recorded)
 		ast_filedelete(backup, NULL);
 	if (prepend_duration)




More information about the asterisk-commits mailing list