[Asterisk-code-review] res_pjsip_pubsub: Increment persistence data ref when recreating. (asterisk[17.2])

George Joseph asteriskteam at digium.com
Thu Jan 30 09:40:08 CST 2020


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/13715 )

Change subject: res_pjsip_pubsub: Increment persistence data ref when recreating.
......................................................................

res_pjsip_pubsub: Increment persistence data ref when recreating.

Each subscription needs to have a reference to the persisted data
for it, as well as the main JSON contained within the tree. When
recreating a subscription this did not occur and they both shared
the same reference.

ASTERISK-28714

Change-Id: I706abd49ea182ea367a4ac3feca2706460ae9f4a
(cherry picked from commit 35c9332edf013685cda733d275264877feb02707)
---
M res/res_pjsip_pubsub.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index 32e0adf..bfa3dc9 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -1264,7 +1264,7 @@
 	 */
 
 	if (tree->persistence && tree->persistence->generator_data) {
-		sub->persistence_data = ast_json_object_get(tree->persistence->generator_data, resource);
+		sub->persistence_data = ast_json_ref(ast_json_object_get(tree->persistence->generator_data, resource));
 	}
 
 	sub->handler = handler;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13715
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 17.2
Gerrit-Change-Id: I706abd49ea182ea367a4ac3feca2706460ae9f4a
Gerrit-Change-Number: 13715
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200130/35d67785/attachment.html>


More information about the asterisk-code-review mailing list