From: Corey Farrell Date: Wed, 13 Jul 2016 18:45:07 +0000 (-0400) Subject: chan_sip: Fix reference leak in mwi_event_cb X-Git-Tag: 13.11.0-rc1~34^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2be13d62fd35472d30b52d0e6bdc33390b0f17f6;p=thirdparty%2Fasterisk.git chan_sip: Fix reference leak in mwi_event_cb Cleanup the peer reference when stasis_subscription_final_message is true. Also free peer_name even if peer exists, after reload a new peer_name will be allocated. ASTERISK-26193 #close Change-Id: If7ecd52facdc5c227f701c760841e3f6ca53cc69 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index c14f8ba075..0336e2a342 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -17186,10 +17186,8 @@ static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct struct sip_peer *peer = sip_find_peer(peer_name, NULL, TRUE, FINDALLDEVICES, FALSE, 0); if (stasis_subscription_final_message(sub, msg)) { - if (peer) { - /* configuration reloaded */ - return; - } + /* peer can be non-NULL during reload. */ + ao2_cleanup(peer); ast_free(peer_name); return; }