[Asterisk-code-review] app voicemail: Cleanup mailbox topic and cache (asterisk[master])

George Joseph asteriskteam at digium.com
Mon Sep 24 11:46:50 CDT 2018


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/10215 )

Change subject: app_voicemail:  Cleanup mailbox topic and cache
......................................................................

app_voicemail:  Cleanup mailbox topic and cache

app_voicemail wasn't properly cleaning up the stasis cache or the
mwi topic pool when the module was unloaded or when a user was
deleted as a result of a reload.  This resulted in leaks in both
areas.

* app_voicemail now calls ast_delete_mwi_state_full when it frees
  a user structure and ast_delete_mwi_state_full in turn now calls
  the new stasis_topic_pool_delete_topic function to clear the topic
  from the pool.

Change-Id: Ide23144a4a810e7e0faad5a8e988d15947965df8
---
M apps/app_voicemail.c
M main/app.c
2 files changed, 7 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index c5afb32..0e00375 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -2020,6 +2020,10 @@
 		return;
 	}
 
+	if (!ast_strlen_zero(vmu->mailbox)) {
+		ast_delete_mwi_state_full(vmu->mailbox, vmu->context, NULL);
+	}
+
 	ast_free(vmu->email);
 	vmu->email = NULL;
 	ast_free(vmu->emailbody);
diff --git a/main/app.c b/main/app.c
index 2135335..953b77d 100644
--- a/main/app.c
+++ b/main/app.c
@@ -3344,6 +3344,9 @@
 	if (clear_msg) {
 		stasis_publish(mailbox_specific_topic, clear_msg);
 	}
+
+	stasis_topic_pool_delete_topic(mwi_topic_pool, stasis_topic_name(mailbox_specific_topic));
+
 	ao2_cleanup(clear_msg);
 	return 0;
 }

-- 
To view, visit https://gerrit.asterisk.org/10215
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ide23144a4a810e7e0faad5a8e988d15947965df8
Gerrit-Change-Number: 10215
Gerrit-PatchSet: 5
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2 (1000185)
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180924/aedfc50d/attachment.html>


More information about the asterisk-code-review mailing list