<p>This is actually the issue I think we encountered originally with <code>drouting.c</code> and which I was trying to fix with <a href="https://github.com/OpenSIPS/opensips/pull/153" class="issue-link" title="dr_state_flusher() might be called before the data structures are initialized">#153</a> ; obviously this is a different issue.</p>

<p>At line 484 of drouting.c:</p>

<pre><code>if ( (gw-&gt;flags &amp; DR_DST_STAT_DIRT_FLAG)==0 )
</code></pre>

<p><code>gw</code> was the variable used in the loop above (line 454 to 472); however at that point the loop is over, so <code>gw</code> must be NULL.</p>

<p>(It took me a while to understand what was happening, because the optimizer was optimizing the variable out, so i first thought it was an optimizer bug when looking in gdb.)</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href='https://github.com/OpenSIPS/opensips/issues/154'>view it on GitHub</a>.<img src='https://github.com/notifications/beacon/5479561__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcwMzk4MTIyNywiZGF0YSI6eyJpZCI6MjI3NTEzMzl9fQ==--e139427a5991b665b5d9cd9598a3078096e1d3e1.gif' height='1' width='1'></p>