<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/4303/">https://reviewboard.asterisk.org/r/4303/</a>
</td>
</tr>
</table>
<br />
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Actually, response->client_state *should* be being unreffed (see "registration_response_destroy") as response gets cleaned up by its RAII_VAR in "handle_registration_response". So something else must be leaking the ref.
What else is odd is that "client_state" object passed into the registration_response_cb (via the pjsip_regc_cbparam -> token) does not seem to have a ref initially added for it when handed to the underlying pjsip code (see the "pjsip_regc_create" function in "sip_outbound_registration_regc_alloc") unless I am missing something. So, I'd almost think the cleanup code on it in "sip_outbound_registration_response_cb" would cause a problem.
It looks like in "handle_client_registration" the client_state is being bumped everytime before sending. I don't think it needs to be. As mentioned the underlying pjsip framework maintains a pointer (a ref needs to be added as it doesn't have one now) that gets handed to the response callback. I *think* if you add the initial ref on create and remove the one before send it will alleviate the extra ref.</pre>
<br />
<p>- Kevin Harwell</p>
<br />
<p>On December 30th, 2014, 4:24 p.m. CST, George Joseph 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.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By George Joseph.</div>
<p style="color: grey;"><i>Updated Dec. 30, 2014, 4:24 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;">Every time a registration started, sip_outbound_registration_response_cb bumps the ref count on client_state then pushes a handle_registration_response task. handle_registration_response never unreffed it though. So every time a registration goes out, the ref count goes up by one.
This patch adds the unreffs to handle_registration_response.
</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;">Watched the ref count on client_state in no-auth registrations, auth-successful registrations and auth-failed registrations to make sure the ref count stayed stable.
</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/13/res/res_pjsip_outbound_registration.c <span style="color: grey">(430163)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/4303/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>