From: Matthew Jordan Date: Thu, 21 Nov 2013 17:49:28 +0000 (+0000) Subject: res_pjsip_mwi: Fix memory leak of MWI subscriptions container X-Git-Tag: 12.0.0-beta2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef01e90ecf3e6010f3772e7e62cf24c2e7aca9dd;p=thirdparty%2Fasterisk.git res_pjsip_mwi: Fix memory leak of MWI subscriptions container This patch fixes a reference counting memory leak on the ao2_container created as part of create_mwi_subscriptions. When we create the container in this routine, the intent is to hand lifetime ownership over to the global container unsolicited_mwi. When ao2_global_obj_replace_unref is called, the reference count on mwi_subscriptions (the container) will be bumped by 1; however, the function does not decrement the reference count on mwi_subscriptions when this occurs. This will prevent the container from being fully disposed of when Asterisk exits (or on any subsequent call to this operation, such as during a reload). git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@402940 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c index 6bed363927..bd865eec4c 100644 --- a/res/res_pjsip_mwi.c +++ b/res/res_pjsip_mwi.c @@ -682,6 +682,7 @@ static void create_mwi_subscriptions(void) } ao2_callback(endpoints, OBJ_NODATA, create_mwi_subscriptions_for_endpoint, mwi_subscriptions); ao2_global_obj_replace_unref(unsolicited_mwi, mwi_subscriptions); + ao2_ref(mwi_subscriptions, -1); } static int reload(void)