]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_voicemail: Cleanup mailbox topic and cache
authorGeorge Joseph <gjoseph@digium.com>
Thu, 20 Sep 2018 15:15:48 +0000 (09:15 -0600)
committerGeorge Joseph <gjoseph@digium.com>
Thu, 20 Sep 2018 18:06:26 +0000 (12:06 -0600)
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

apps/app_voicemail.c
main/app.c

index f2b6c97a3a4c6d9fc532b906f0fb700875af1077..b371e4722ee0b2ab89b581218d6912e7d856a653 100644 (file)
@@ -2004,6 +2004,10 @@ static void free_user(struct ast_vm_user *vmu)
                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);
index e7aab10b1fabf14afcbfcaf9b9134b283b74a89c..bc28ef6913cc60345a7f06e71fcc9a825563e436 100644 (file)
@@ -3355,6 +3355,9 @@ int ast_delete_mwi_state_full(const char *mailbox, const char *context, struct a
        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;
 }