<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/2832/">https://reviewboard.asterisk.org/r/2832/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On September 6th, 2013, 10:56 p.m. UTC, <b>wdoekes</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I wonder if an ast_realloc_or_free() wouldn't have been cleaner though.
void *ast_realloc_or_free(void *ptr, size_t size) {
void *new = ast_realloc(ptr, size);
if (!new) {
free(ptr);
return NULL;
}
return new;
}</pre>
</blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">That kind of routine would only work if ptr is just an allocated buffer. Is many cases that buffer is an array of pointers to allocated strings. Simply freeing that buffer would then leave any allocated strings orphaned.</pre>
<br />
<p>- rmudgett</p>
<br />
<p>On September 6th, 2013, 10:36 p.m. UTC, rmudgett wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/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.</div>
<div>By rmudgett.</div>
<p style="color: grey;"><i>Updated Sept. 6, 2013, 10:36 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>
<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;">There are several locations in the code base where this is done:
buf = ast_realloc(buf, new_size);
This is going to leak the original buf contents if the realloc fails.
Several of these incorrect usages should apply to v1.8 and v11.</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;">Mostly compiled the code and code inspection.
* The CLI tab completion still works.
* MOH still plays.
* Online XML documentation still shows application syntax.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/branches/12/funcs/func_dialgroup.c <span style="color: grey">(398615)</span></li>
<li>/branches/12/main/asterisk.c <span style="color: grey">(398615)</span></li>
<li>/branches/12/main/cli.c <span style="color: grey">(398615)</span></li>
<li>/branches/12/main/event.c <span style="color: grey">(398615)</span></li>
<li>/branches/12/main/heap.c <span style="color: grey">(398615)</span></li>
<li>/branches/12/main/indications.c <span style="color: grey">(398615)</span></li>
<li>/branches/12/main/xmldoc.c <span style="color: grey">(398615)</span></li>
<li>/branches/12/res/res_musiconhold.c <span style="color: grey">(398615)</span></li>
<li>/branches/12/res/res_pjsip/pjsip_configuration.c <span style="color: grey">(398615)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2832/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>