<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://reviewboard.asterisk.org/r/2071/">https://reviewboard.asterisk.org/r/2071/</a>
     </td>
    </tr>
   </table>
   <br />



 <p>Ship it!</p>



 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Fix the silly goof below and it should be good to go!</pre>
 <br />





<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="https://reviewboard.asterisk.org/r/2071/diff/2/?file=30997#file30997line1394" style="color: black; font-weight: bold; text-decoration: underline;">/branches/1.8/channels/chan_oss.c</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static struct chan_oss_pvt *store_config(struct ast_config *cfg, char *ctg)</pre></td>

  </tr>
 </tbody>



 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">1394</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="k">if</span> <span class="p">(</span><span class="n">asprintf</span><span class="p">(</span><span class="o">&amp;</span><span class="n">cmd</span><span class="p">,</span> <span class="s">&quot;mixer %s&quot;</span><span class="p">,</span> <span class="n">o</span><span class="o">-&gt;</span><span class="n">mixer_cmd</span><span class="p">)</span> <span class="o"><span class="hl">&lt;</span></span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1394</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="k">if</span> <span class="p">(</span><span class="n"><span class="hl">ast_</span>asprintf</span><span class="p">(</span><span class="o">&amp;</span><span class="n">cmd</span><span class="p">,</span> <span class="s">&quot;mixer %s&quot;</span><span class="p">,</span> <span class="n">o</span><span class="o">-&gt;</span><span class="n">mixer_cmd</span><span class="p">)</span> <span class="o"><span class="hl">&gt;</span></span><span class="hl"> </span><span class="o"><span class="hl">=</span></span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Too much spacing, it is: &gt;=</pre>
</div>
<br />

<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="https://reviewboard.asterisk.org/r/2071/diff/2/?file=31000#file31000line1148" style="color: black; font-weight: bold; text-decoration: underline;">/branches/1.8/main/file.c</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">struct ast_filestream *ast_writefile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1146</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">buf</span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1147</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                        <span class="n">ast_free</span><span class="p">(</span><span class="n">fn</span><span class="p">);</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1148</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                <span class="p">}</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Good catch.  I didn&#39;t see this leak earlier.</pre>
</div>
<br />



<p>- rmudgett</p>


<br />
<p>On August 16th, 2012, 6:21 p.m., Mark Michelson wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers and rmudgett.</div>
<div>By Mark Michelson.</div>


<p style="color: grey;"><i>Updated Aug. 16, 2012, 6:21 p.m.</i></p>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This contains several fixes involving the misuse of asprintf()

* All uses of asprintf() have been changed to ast_asprintf() and all uses of vasprintf() have been changed to ast_vasprintf(). This is because these are typically paired with calls to ast_free(). When using MALLOC_DEBUG, we must pair ast_ allocation calls with ast_free() or else unfun things happen.

* All uses of ast_asprintf() are now checked for failure. The biggest offender here was xmldoc.c. If there are errors in this review, this is the most likely file to find them.

* Any failure cases of ast_asprintf() that result in the allocated memory being potentially referenced later now explicitly NULLs out the pointer because asprintf() does not define what the pointer will be pointing to after an allocation failure.

* Fixed a memory leak in res_config_sqlite3 where an ast_asprintf() call did not have the resultant allocated memory freed.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Compiled, ran Asterisk, and ran some calls. Nothing catastrophic occurred.</pre>
  </td>
 </tr>
</table>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="https://issues.asterisk.org/jira/browse/ASTERISK-20135">ASTERISK-20135</a>


</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/branches/1.8/main/file.c <span style="color: grey">(371391)</span></li>

 <li>/branches/1.8/main/utils.c <span style="color: grey">(371391)</span></li>

 <li>/branches/1.8/main/xmldoc.c <span style="color: grey">(371391)</span></li>

 <li>/branches/1.8/pbx/pbx_config.c <span style="color: grey">(371391)</span></li>

 <li>/branches/1.8/res/res_config_sqlite.c <span style="color: grey">(371391)</span></li>

 <li>/branches/1.8/res/res_jabber.c <span style="color: grey">(371391)</span></li>

 <li>/branches/1.8/channels/chan_sip.c <span style="color: grey">(371391)</span></li>

 <li>/branches/1.8/funcs/func_odbc.c <span style="color: grey">(371391)</span></li>

 <li>/branches/1.8/apps/app_dial.c <span style="color: grey">(371391)</span></li>

 <li>/branches/1.8/apps/app_queue.c <span style="color: grey">(371391)</span></li>

 <li>/branches/1.8/apps/app_stack.c <span style="color: grey">(371391)</span></li>

 <li>/branches/1.8/cdr/cdr_tds.c <span style="color: grey">(371391)</span></li>

 <li>/branches/1.8/channels/chan_dahdi.c <span style="color: grey">(371391)</span></li>

 <li>/branches/1.8/channels/chan_oss.c <span style="color: grey">(371391)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/2071/diff/" style="margin-left: 3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>