[Asterisk-code-review] res_pjsip: Fix transport_states ref leak (...asterisk[16])
Friendly Automation
asteriskteam at digium.com
Thu Apr 11 14:57:27 CDT 2019
Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11252 )
Change subject: res_pjsip: Fix transport_states ref leak
......................................................................
res_pjsip: Fix transport_states ref leak
Add missing ao2_ref(transport_state, -1) while iterate on a transport_states
container.
Change-Id: I40e35b5a339121300c80075c30db47201a6c374e
---
M res/res_pjsip/pjsip_message_filter.c
1 file changed, 6 insertions(+), 7 deletions(-)
Approvals:
Sean Bright: Looks good to me, but someone else must approve
Richard Mudgett: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/res/res_pjsip/pjsip_message_filter.c b/res/res_pjsip/pjsip_message_filter.c
index a144213..b70985b 100644
--- a/res/res_pjsip/pjsip_message_filter.c
+++ b/res/res_pjsip/pjsip_message_filter.c
@@ -111,14 +111,13 @@
}
for (iter = ao2_iterator_init(transport_states, 0); (transport_state = ao2_iterator_next(&iter)); ao2_ref(transport_state, -1)) {
- if (transport_state && ((transport_state->type != AST_TRANSPORT_UDP) ||
- (pj_strcmp(&transport_state->transport->local_name.host, address)) ||
- (transport_state->transport->local_name.port != port))) {
- continue;
+ if (transport_state->type == AST_TRANSPORT_UDP &&
+ !pj_strcmp(&transport_state->transport->local_name.host, address) &&
+ transport_state->transport->local_name.port == port) {
+ sip_transport = transport_state->transport;
+ ao2_ref(transport_state, -1);
+ break;
}
-
- sip_transport = transport_state->transport;
- break;
}
ao2_iterator_destroy(&iter);
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11252
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I40e35b5a339121300c80075c30db47201a6c374e
Gerrit-Change-Number: 11252
Gerrit-PatchSet: 2
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190411/92efb3fe/attachment.html>
More information about the asterisk-code-review
mailing list