[Asterisk-code-review] res_pjsip: Fix transport_states ref leak (...asterisk[13])
George Joseph
asteriskteam at digium.com
Thu Apr 11 15:00:29 CDT 2019
George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11257 )
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
George Joseph: Looks good to me, approved; Approved for Submit
diff --git a/res/res_pjsip/pjsip_message_filter.c b/res/res_pjsip/pjsip_message_filter.c
index 8a63219..5fe19f9 100644
--- a/res/res_pjsip/pjsip_message_filter.c
+++ b/res/res_pjsip/pjsip_message_filter.c
@@ -110,14 +110,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/+/11257
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I40e35b5a339121300c80075c30db47201a6c374e
Gerrit-Change-Number: 11257
Gerrit-PatchSet: 1
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph 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/2acc2fb1/attachment.html>
More information about the asterisk-code-review
mailing list