<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/1395/">https://reviewboard.asterisk.org/r/1395/</a>
</td>
</tr>
</table>
<br />
<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.</div>
<div>By wdoekes.</div>
<p style="color: grey;"><i>Updated Oct. 12, 2011, 3:20 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</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;">Did Terry's suggestion of checking sippeers for insecure anyway.
With the following modifications:
(1) If we're using LIKE here, we better use it for the existing checks as well.
(2) Moved ast_variables_dup() to main/config.c
(3) Fixed leaks and added proper insecure=port check to Terry's example code.
(4) Reused already fetched var which should save us a query (per Terry's suggestion on IRC).
(5) Edited existing function names for consistency.
(6) Trimmed the comments about removing sipregs down to a minimum.
Although it would almost be functioning as promised (apart from the need for the ipaddr column in sippeer which we still need), we have now succeeded in slowing down realtime_peer() even further. But this will be greatly mitigated when/if Terry fixes that 'ast_load_realtime_multientry' returns NULL for zero results.
Testing done: code compiles, no further tests done
http://images.memegenerator.net/instances/400x/9689481.jpg</pre>
</td>
</tr>
</table>
<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 memory leaks in realtime_peer in chan_sip.c. For a thorough explanation, see the bug report.
Trying to patch those leaks would be making ugly code even uglier. This is an attempt at cleaning up the code a bit.
I attempted to keep the exact same behaviour as the original code, while increasing readability. (I had to clone the variable gotten from the peerlist to get proper cleanup behaviour.)
Differences:
- sippeers ipaddr is now checked even though sippeers host was not matched (I could not make sense of why ipaddr wasn't checked when host was not matched)
- I don't check sipregs for the insecure column
- the leaks should be gone ;)
Up for review here, because the changes are significant enough for me to have made (lots of) errors and because someone might feel that a rewrite is not the way to go.</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;">I tested that I got the same behaviour for the tests mentioned in the bug report. The leaks are gone, the bevahour seemed the same.
I'm too tired to test normal cases right now though.</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-18356">ASTERISK-18356</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> (updated)</h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/branches/1.8/configs/extconfig.conf.sample <span style="color: grey">(340521)</span></li>
<li>/branches/1.8/include/asterisk/config.h <span style="color: grey">(340521)</span></li>
<li>/branches/1.8/main/config.c <span style="color: grey">(340521)</span></li>
<li>/branches/1.8/channels/chan_sip.c <span style="color: grey">(340521)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1395/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>