<p>The msg_apply_changes() must be used only before the transaction is created. A related discussion was few months on mailing list:</p>

<ul>
<li><a href="http://lists.sip-router.org/pipermail/sr-users/2015-December/091059.html">http://lists.sip-router.org/pipermail/sr-users/2015-December/091059.html</a></li>
</ul>

<p>I guess there was a race in this particular case, because:</p>

<pre><code>#2  0x00000000005ec6e7 in qm_free (qm=0x7efc5c71c010, p=0x0, file=0x6f2c25 "<core>: parser/hf.c", func=0x0, line=10007232) at mem/q_malloc.c:441
</code></pre>

<p>But th p==0 is checked for safety in the function:</p>

<ul>
<li><a href="https://github.com/kamailio/kamailio/blob/master/mem/q_malloc.c#L458">https://github.com/kamailio/kamailio/blob/master/mem/q_malloc.c#L458</a></li>
</ul>

<p>Setting mem_safety=1 in kamailio.cfg would have prevented this particular crash, but perhaps it is still vulnerable to crash because of other pointers being invalid later.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/676#issuecomment-226766865">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AF36ZTINOQgyrgOpuMHQx-tE6I2nRLzJks5qMp8TgaJpZM4I4VEp">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36Zed8mom2Xy1wpp5LLm5_Lk36gdAlks5qMp8TgaJpZM4I4VEp.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/676#issuecomment-226766865"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>