]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_pubsub: Increment persistence data ref when recreating.
authorJoshua C. Colp <jcolp@sangoma.com>
Tue, 28 Jan 2020 15:18:45 +0000 (15:18 +0000)
committerJoshua Colp <jcolp@sangoma.com>
Tue, 28 Jan 2020 15:24:24 +0000 (09:24 -0600)
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

res/res_pjsip_pubsub.c

index 57120233137d67992eb333f9b0eda6f36a26e54c..99b2ebbe3dabb5e5b4aea78b3b3f5fe477cadad6 100644 (file)
@@ -1287,7 +1287,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;