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

George Joseph asteriskteam at digium.com
Thu Jan 30 09:22:27 CST 2020


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

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
---
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/+/13706
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

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


More information about the asterisk-code-review mailing list