Review Board 1.7.16


res_pjsip_phoneprov_provider: Fix reference leak on unload

Review Request #4608 - Created April 9, 2015 and submitted

George Joseph
13
ASTERISK-24935
Reviewers
asterisk-dev
coreyfarrell
Asterisk
res_pjsip_phoneprov_provider was leaking references to phoneprov objects due to a missing OBJ_NODATA in an ao2_callback in load_users().  Rather than adding the OBJ_NODATA, I changed load_users to use a more straightforward ao2_iterator.  This plugged the leak but exposed an unload order issue between res_pjsip_phoneprov_provider, res_phoneprov and res_pjsip.

res_pjsip_phoneprov_provider unloads first, then res_phoneprov, then res_pjsip.  Since res_pjsip_phoneprov_provider uses res_pjsip's sorcery instance, when it unloads, it's objects are still in the sorcery instance.  When res_pjsip unloads, it destroys all its objects including res_pjsip_phoneprov_provider's.  The phoneprov destructor then attempts to unregister the extension from res_phoneprov but because res_phoneprov is already cleaned up, its users container is gone and we get a FRACK.

Simple solution, check for the NULL users container before attempting to remove the entry. Duh.
Ran tests/res_phoneprov/res_phoneprov_provider.  No leaks in res_pjsip_phoneprov_provider and no FRACKs.
Total:
2
Open:
0
Resolved:
2
Dropped:
0
Status:
From:
Description From Last Updated Status
Review request changed
Updated (April 9, 2015, 6:23 p.m.)
  • changed from pending to submitted
Committed in revision 434562

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.