[asterisk-commits] tilghman: branch 1.4 r135479 - /branches/1.4/apps/app_voicemail.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Aug 4 11:56:20 CDT 2008
Author: tilghman
Date: Mon Aug 4 11:56:19 2008
New Revision: 135479
URL: http://svn.digium.com/view/asterisk?view=rev&rev=135479
Log:
Memory leak on unload
(closes issue #13231)
Reported by: eliel
Patches:
app_voicemail.leak.patch uploaded by eliel (license 64)
Modified:
branches/1.4/apps/app_voicemail.c
Modified: branches/1.4/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=135479&r1=135478&r2=135479
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Mon Aug 4 11:56:19 2008
@@ -7844,10 +7844,28 @@
voicemail_show_zones_help, NULL, &cli_show_voicemail_zones_deprecated },
};
-static int load_config(void)
+static void free_vm_users(void)
{
struct ast_vm_user *cur;
struct vm_zone *zcur;
+
+ 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);
+
+ AST_LIST_LOCK(&zones);
+ while ((zcur = AST_LIST_REMOVE_HEAD(&zones, list))) {
+ free_zone(zcur);
+ }
+ AST_LIST_UNLOCK(&zones);
+}
+
+static int load_config(void)
+{
+ struct ast_vm_user *cur;
struct ast_config *cfg, *ucfg;
char *cat;
struct ast_variable *var;
@@ -7897,16 +7915,9 @@
cfg = ast_config_load(VOICEMAIL_CONFIG);
+ free_vm_users();
+
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);
memset(ext_pass_cmd, 0, sizeof(ext_pass_cmd));
More information about the asterisk-commits
mailing list