diff options
author | Corey Farrell <git@cfware.com> | 2016-07-13 14:45:07 -0400 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2016-07-13 14:10:41 -0500 |
commit | f73ddde7d4c5d4f7a675e13a4680d03426648bcd (patch) | |
tree | 1eef387aa7df6bb77dc08c6153248984ac52fbec /channels/chan_sip.c | |
parent | 73d8cb587d6515b707c9cafe334e18fbd7c24905 (diff) |
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
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 599ecd639..b2522b6db 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -17229,10 +17229,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; } |