]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_pubsub: Resolve potential crash in allocate_subscription.
authorCorey Farrell <git@cfware.com>
Fri, 27 Oct 2017 18:41:15 +0000 (14:41 -0400)
committerCorey Farrell <git@cfware.com>
Fri, 27 Oct 2017 18:53:30 +0000 (13:53 -0500)
When allocate_subscription fails to initialize fields of the new sub it
calls destroy_subscription.

Change-Id: I5b79c915ec216dc00c13c1e4172137864a4bec85

res/res_pjsip_pubsub.c

index ae61a49003caf4b871d6a6a8714fa102c94b02fc..e2c6f6ced593c9c59d1fb866cb057281a23d09b4 100644 (file)
@@ -1111,7 +1111,7 @@ static void remove_subscription(struct sip_subscription_tree *obj)
 static void destroy_subscription(struct ast_sip_subscription *sub)
 {
        ast_debug(3, "Destroying SIP subscription from '%s->%s'\n",
-               sub->tree->endpoint ? ast_sorcery_object_get_id(sub->tree->endpoint) : "Unknown",
+               sub->tree && sub->tree->endpoint ? ast_sorcery_object_get_id(sub->tree->endpoint) : "Unknown",
                sub->resource);
 
        ast_free(sub->body_text);