[asterisk-commits] tilghman: branch 1.6.0 r135481 - in /branches/1.6.0: ./ apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 4 12:03:46 CDT 2008


Author: tilghman
Date: Mon Aug  4 12:03:46 2008
New Revision: 135481

URL: http://svn.digium.com/view/asterisk?view=rev&rev=135481
Log:
Merged revisions 135480 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r135480 | tilghman | 2008-08-04 11:58:29 -0500 (Mon, 04 Aug 2008) | 14 lines

Merged revisions 135479 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r135479 | tilghman | 2008-08-04 11:56:19 -0500 (Mon, 04 Aug 2008) | 6 lines

Memory leak on unload
(closes issue #13231)
 Reported by: eliel
 Patches: 
       app_voicemail.leak.patch uploaded by eliel (license 64)

........

................

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=135481&r1=135480&r2=135481
==============================================================================
--- branches/1.6.0/apps/app_voicemail.c (original)
+++ branches/1.6.0/apps/app_voicemail.c Mon Aug  4 12:03:46 2008
@@ -8284,10 +8284,31 @@
 	return RESULT_SUCCESS;
 }
 
+/*! \brief Free the users structure. */
+static void free_vm_users(void) 
+{
+	struct ast_vm_user *cur;
+	AST_LIST_LOCK(&users);
+	while ((cur = AST_LIST_REMOVE_HEAD(&users, list))) {
+		ast_set_flag(cur, VM_ALLOCED);
+		free_user(cur);
+	}
+	AST_LIST_UNLOCK(&users);
+}
+
+/*! \brief Free the zones structure. */
+static void free_vm_zones(void)
+{
+	struct vm_zone *zcur;
+	AST_LIST_LOCK(&zones);
+	while ((zcur = AST_LIST_REMOVE_HEAD(&zones, list)))
+		free_zone(zcur);
+	AST_LIST_UNLOCK(&zones);
+}
+
 static int load_config(int reload)
 {
 	struct ast_vm_user *cur;
-	struct vm_zone *zcur;
 	struct ast_config *cfg, *ucfg;
 	char *cat;
 	struct ast_variable *var;
@@ -8315,17 +8336,14 @@
 	strcpy(listen_control_pause_key, DEFAULT_LISTEN_CONTROL_PAUSE_KEY);
 	strcpy(listen_control_restart_key, DEFAULT_LISTEN_CONTROL_RESTART_KEY);
 	strcpy(listen_control_stop_key, DEFAULT_LISTEN_CONTROL_STOP_KEY);
-	
-	AST_LIST_LOCK(&users);
-	while ((cur = AST_LIST_REMOVE_HEAD(&users, list))) {
-		ast_set_flag(cur, VM_ALLOCED);
-		free_user(cur);
-	}
-
-	AST_LIST_LOCK(&zones);
-	while ((zcur = AST_LIST_REMOVE_HEAD(&zones, list))) 
-		free_zone(zcur);
-	AST_LIST_UNLOCK(&zones);
+
+	/* Free all the users structure */	
+	free_vm_users();
+
+	/* Free all the zones structure */
+	free_vm_zones();
+
+	AST_LIST_LOCK(&users);	
 
 	memset(ext_pass_cmd, 0, sizeof(ext_pass_cmd));
 
@@ -8947,6 +8965,9 @@
 	if (poll_thread != AST_PTHREADT_NULL)
 		stop_poll_thread();
 
+
+	free_vm_users();
+	free_vm_zones();
 	return res;
 }
 




More information about the asterisk-commits mailing list