summaryrefslogtreecommitdiff
path: root/res/res_pjsip_pubsub.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2016-02-15 14:52:22 -0400
committerJoshua Colp <jcolp@digium.com>2016-02-15 13:01:54 -0600
commit5c400a0fedffface7d7b41c40bcaa2810ca6da15 (patch)
tree9a9973d8836561857090be25c642c5187d0c2e32 /res/res_pjsip_pubsub.c
parent1783edd181ede9847ba6e34137c8e7051f135525 (diff)
res_pjsip_pubsub: Move where the subscription is stored to after initialized.
A problem arose when testing the AMI subscription listing actions where it was possible for a subscription that had not been fully initialized to be listed. This was problematic as the underlying listing code would crash. This change makes it so the subscription tree is fully set up before it is added to the list of subscriptions. This ensures that when the listing actions get the subscription it is valid. ASTERISK-25738 #close Change-Id: Iace2b13641c31bbcc0d43a39f99aba1f340c0f48
Diffstat (limited to 'res/res_pjsip_pubsub.c')
-rw-r--r--res/res_pjsip_pubsub.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index dc7f5ed9e..bde7075dd 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -1254,7 +1254,6 @@ static struct sip_subscription_tree *allocate_subscription_tree(struct ast_sip_e
sub_tree->endpoint = ao2_bump(endpoint);
sub_tree->notify_sched_id = -1;
- add_subscription(sub_tree);
return sub_tree;
}
@@ -1328,6 +1327,8 @@ static struct sip_subscription_tree *create_subscription_tree(const struct ast_s
sub_tree->is_list = 1;
}
+ add_subscription(sub_tree);
+
return sub_tree;
}
@@ -1616,6 +1617,8 @@ struct ast_sip_subscription *ast_sip_create_subscription(const struct ast_sip_su
return NULL;
}
+ add_subscription(sub_tree);
+
return sub;
}