[Asterisk-code-review] res xmpp: Fix ref counting issue (asterisk[13])
Sean Bright
asteriskteam at digium.com
Fri Mar 24 07:16:05 CDT 2017
Sean Bright has posted comments on this change. ( https://gerrit.asterisk.org/5287 )
Change subject: res_xmpp: Fix ref counting issue
......................................................................
Patch Set 1:
(1 comment)
https://gerrit.asterisk.org/#/c/5287/1/res/res_xmpp.c
File res/res_xmpp.c:
Line 564
> I think this should stay? When endpoint_internal_create returns it bumps th
> I think this should stay? When endpoint_internal_create returns it
> bumps the endpoint's ref by 1. What removes it?
When control returns from ast_endpoint_create, the endpoint has a refcount of 2 - 1 from the linking into the endpoints container, and another from the ao2_ref() at the end of endpoint_internal_create.
When we call ast_endpoint_shutdown, the endpoint is unlinked from the endpoints container (-1) and then a message is published to the stasis endpoint topic causing endpoint_default() to be called, which removes the last reference.
> Also won't removing this cause a leak in some of the off nominal
> paths in client alloc? For instance, say the endpoint is created,
> but the buddies container is not then endpoint would be leaked?
No because we deref the client object in those failure conditions which would cause the destructor to be called which would call ast_endpoint_shutdown just as in a normal unload.
--
To view, visit https://gerrit.asterisk.org/5287
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I912a2692e52d3e2ed445b32d8ae3f9004bc2f2e8
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-HasComments: Yes
More information about the asterisk-code-review
mailing list