<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/5834">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_pubsub: Fix reference to released endpoint<br><br>destroy_subscription was attempting to get the id of the<br>subscription tree's endpoint after we'd already called ao2_cleanup<br>on it causing a segfault.<br><br>Moved the cleanup until after the debug statement and since<br>endpoint could also be NULL at this point, check for that as well.<br><br>ASTERISK-27057 #close<br>Reported-by: Ryan Smith<br><br>Change-Id: Ice0a7727f560cf204d870a774c6df71e159b1678<br>---<br>M res/res_pjsip_pubsub.c<br>1 file changed, 5 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/34/5834/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c<br>index a1f3f24..9f0eae2 100644<br>--- a/res/res_pjsip_pubsub.c<br>+++ b/res/res_pjsip_pubsub.c<br>@@ -1086,7 +1086,9 @@<br> static void destroy_subscription(struct ast_sip_subscription *sub)<br> {<br> ast_debug(3, "Destroying SIP subscription from '%s->%s'\n",<br>- ast_sorcery_object_get_id(sub->tree->endpoint), sub->resource);<br>+ sub->tree->endpoint ? ast_sorcery_object_get_id(sub->tree->endpoint) : "Unknown",<br>+ sub->resource);<br>+<br> ast_free(sub->body_text);<br> <br> AST_VECTOR_FREE(&sub->children);<br>@@ -1243,14 +1245,14 @@<br> sub_tree->endpoint ? ast_sorcery_object_get_id(sub_tree->endpoint) : "Unknown",<br> sub_tree->root ? sub_tree->root->resource : "Unknown");<br> <br>- ao2_cleanup(sub_tree->endpoint);<br>-<br> destroy_subscriptions(sub_tree->root);<br> <br> if (sub_tree->dlg) {<br> ast_sip_push_task_synchronous(sub_tree->serializer, subscription_unreference_dialog, sub_tree);<br> }<br> <br>+ ao2_cleanup(sub_tree->endpoint);<br>+<br> ast_taskprocessor_unreference(sub_tree->serializer);<br> ast_module_unref(ast_module_info->self);<br> }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/5834">change 5834</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/5834"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 14 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ice0a7727f560cf204d870a774c6df71e159b1678 </div>
<div style="display:none"> Gerrit-Change-Number: 5834 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>