<p>This is due to the dialog module mod_init method using the cachedb<br>
module methods before child_init has been called.</p>

<p>In that case, the SQL handled is still set to NULL.</p>

<p>Fixes issue <a href="https://github.com/OpenSIPS/opensips/issues/197" class="issue-link" title="OpenSIPS 1.8.4 can not be started when there are dialogs in the dialogs table">#197</a>.</p>

<hr>

<h4>You can merge this Pull Request by running</h4>
<pre>  git pull https://github.com/dsandras/opensips ds-fix-cachedbsql-crash</pre>
<p>Or view, comment on, or merge it at:</p>
<p>&nbsp;&nbsp;<a href='https://github.com/OpenSIPS/opensips/pull/206'>https://github.com/OpenSIPS/opensips/pull/206</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>OpenSIPS: Fixed possible crash in cachedb module.</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/OpenSIPS/opensips/pull/206/files#diff-0">modules/cachedb_sql/cachedb_sql.c</a>
    (9)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/OpenSIPS/opensips/pull/206.patch'>https://github.com/OpenSIPS/opensips/pull/206.patch</a></li>
  <li><a href='https://github.com/OpenSIPS/opensips/pull/206.diff'>https://github.com/OpenSIPS/opensips/pull/206.diff</a></li>
</ul>

<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/pull/206'>view it on GitHub</a>.<img src='https://github.com/notifications/beacon/5479561__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxMzI2MjUyMSwiZGF0YSI6eyJpZCI6MzAxMzY4NDB9fQ==--acf39f350a4afac2584115934c47688d3d100033.gif' height='1' width='1'></p>