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

George Joseph asteriskteam at digium.com
Mon Sep 24 09:30:32 CDT 2018


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

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:
  Kevin Harwell: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  George Joseph: Approved for Submit



diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index f2b6c97..b371e47 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -2004,6 +2004,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 e7aab10..bc28ef6 100644
--- a/main/app.c
+++ b/main/app.c
@@ -3355,6 +3355,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/10212
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: Ide23144a4a810e7e0faad5a8e988d15947965df8
Gerrit-Change-Number: 10212
Gerrit-PatchSet: 2
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/f8e1c7d8/attachment-0001.html>


More information about the asterisk-code-review mailing list