]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip_pubsub: Fix ao2 reference leak of subscription tree in ast_sip_subscription
authorAlexei Gradinari <alex2grad@gmail.com>
Wed, 7 Jan 2026 20:39:05 +0000 (15:39 -0500)
committerAlexei Gradinari <alex2grad@gmail.com>
Thu, 22 Jan 2026 17:51:17 +0000 (17:51 +0000)
commita8a602342b96fb98cc340feecb9fc2384e209260
tree2e443a7a8c02fd15da1d7236ca8143d545a3a106
parent4d92360977801cf0468bf99f178afc4f7d83d86a
res_pjsip_pubsub: Fix ao2 reference leak of subscription tree in ast_sip_subscription

allocate_subscription() increments the ao2 reference count of the subscription tree,
but the reference was not consistently released during subscription destruction,
resulting in leaked sip_subscription_tree objects.

This patch makes destroy_subscription() responsible for releasing sub->tree,
removes ad-hoc cleanup in error paths,
and guards tree cleanup to ensure refcount symmetry and correct ownership.

Fixes: #1703
res/res_pjsip_pubsub.c