mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 19:52:48 +00:00
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
This commit is contained in:
@@ -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);
|
struct sip_peer *peer = sip_find_peer(peer_name, NULL, TRUE, FINDALLDEVICES, FALSE, 0);
|
||||||
|
|
||||||
if (stasis_subscription_final_message(sub, msg)) {
|
if (stasis_subscription_final_message(sub, msg)) {
|
||||||
if (peer) {
|
/* peer can be non-NULL during reload. */
|
||||||
/* configuration reloaded */
|
ao2_cleanup(peer);
|
||||||
return;
|
|
||||||
}
|
|
||||||
ast_free(peer_name);
|
ast_free(peer_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user