From: Joshua C. Colp Date: Tue, 28 Jan 2020 15:18:45 +0000 (+0000) Subject: res_pjsip_pubsub: Increment persistence data ref when recreating. X-Git-Tag: 17.3.0-rc1~35^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35c9332edf013685cda733d275264877feb02707;p=thirdparty%2Fasterisk.git 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 --- diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c index 32e0adf540..bfa3dc975c 100644 --- a/res/res_pjsip_pubsub.c +++ b/res/res_pjsip_pubsub.c @@ -1264,7 +1264,7 @@ static struct ast_sip_subscription *allocate_subscription(const struct ast_sip_s */ 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;