]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_pubsub: Fix crash on destruction of empty subscription tree. 95/1495/1
authorMark Michelson <mmichelson@digium.com>
Wed, 2 Sep 2015 14:14:19 +0000 (09:14 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 22 Oct 2015 20:07:41 +0000 (15:07 -0500)
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

res/res_pjsip_pubsub.c

index dc6178650948cca90e907ac4c5934ae2a8906c74..75b286b61e286935e50f8adb2f063e2959734441 100644 (file)
@@ -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;