[Asterisk-code-review] res pjsip: Fix leak of persistent endpoint references. (asterisk[master])

Corey Farrell asteriskteam at digium.com
Fri Oct 6 09:38:00 CDT 2017


Corey Farrell has posted comments on this change. ( https://gerrit.asterisk.org/6657 )

Change subject: res_pjsip: Fix leak of persistent endpoint references.
......................................................................


Patch Set 1:

(4 comments)

https://gerrit.asterisk.org/#/c/6657/1/res/res_pjsip/pjsip_configuration.c
File res/res_pjsip/pjsip_configuration.c:

https://gerrit.asterisk.org/#/c/6657/1/res/res_pjsip/pjsip_configuration.c@1310
PS1, Line 1310: 		persistent->aors = ast_strdup(endpoint->aors);
Move this outside the 'if (!persistant)' block and add an 'else' block to free the existing aors?

In that case if we fail to allocate the aors we'd have to unlink from persistent_endspoints in addition to returning NULL?

persistant is allocated without a lock, do we need to lock anything to make it safe to free the existing aors?


https://gerrit.asterisk.org/#/c/6657/1/res/res_pjsip/pjsip_configuration.c@1320
PS1, Line 1320: 	ao2_ref(persistent->endpoint, +1);
So maybe this should be moved into the 'if (!persistant)' block?


https://gerrit.asterisk.org/#/c/6657/1/res/res_pjsip/pjsip_configuration.c@1329
PS1, Line 1329: 	if (!endpoint->persistent) {
> This may be an issue.  The persistent endpoint has a copy of the endpoint's
See other comments.


https://gerrit.asterisk.org/#/c/6657/1/res/res_pjsip/pjsip_configuration.c@1346
PS1, Line 1346: 	endpoint->media.topology = ast_stream_topology_create_from_format_cap(endpoint->media.codecs);
This is also leaks.  Should I free the existing stream topology or skip reallocating?



-- 
To view, visit https://gerrit.asterisk.org/6657
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I59bbfc8da8a14d5f4af8c5bb1e71f8592ae823eb
Gerrit-Change-Number: 6657
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Comment-Date: Fri, 06 Oct 2017 14:38:00 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171006/4f3b0635/attachment-0001.html>


More information about the asterisk-code-review mailing list