diff options
author | Mark Michelson <mmichelson@digium.com> | 2015-09-02 09:14:19 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2015-10-22 15:07:41 -0500 |
commit | 1bcc5927655c71f2ea0db31c0cd0a3bf0095714d (patch) | |
tree | b408d1fc3c02817932a5c7c3297f2e9c47291fb2 /res/res_pjsip_pubsub.c | |
parent | b3cc2bd7dfad379cec77e7333cc93c23fda6aa92 (diff) |
res_pjsip_pubsub: Fix crash on destruction of empty subscription tree.
If an old persistent subscription is recreated but then immediately
destroyed because it is out of date, the subscription tree will have no
leaf subscriptions on it. This was resulting in a crash when attempting
to destroy the subscription tree.
A simple NULL check fixes this problem.
Change-Id: I85570b9e2bcc7260a3fe0ad85904b2a9bf36d2ac
Diffstat (limited to 'res/res_pjsip_pubsub.c')
-rw-r--r-- | res/res_pjsip_pubsub.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c index dc6178650..75b286b61 100644 --- a/res/res_pjsip_pubsub.c +++ b/res/res_pjsip_pubsub.c @@ -1079,6 +1079,10 @@ static void destroy_subscriptions(struct ast_sip_subscription *root) { int i; + if (!root) { + return; + } + for (i = 0; i < AST_VECTOR_SIZE(&root->children); ++i) { struct ast_sip_subscription *child; |