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

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


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

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

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I706abd49ea182ea367a4ac3feca2706460ae9f4a
Gerrit-Change-Number: 13680
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-CC: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200130/ec78d2c5/attachment-0001.html>


More information about the asterisk-code-review mailing list