<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 28, 2017 at 6:35 PM, Richard Kenner <span dir="ltr"><<a href="mailto:kenner@gnat.com" target="_blank">kenner@gnat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've had two Asterisk crashes today that seem to be caused by errors<br>
where chan->tech_pvt is pointing to something that can't be deallocated<br>
and I think I see a reference count bug in the above function.<br>
<br>
It contains:<br>
<br>
                if (data->chan_old_vsrc) {<br>
                        ast_channel_unref(data->chan_<wbr>old_vsrc);<br>
                }<br>
<br>
Shouldn't this also have:<br>
<br>
                        data->chan_old_vsrc = NULL;<br>
<br>
It seems to me that if it doesn't and the next condition also isn't<br>
true, then the next time this same code is executed, it'll decrement<br>
the reference count of the old channel again, which is wrong since it<br>
hasn't been decremented.<br></blockquote><div><br></div><div>Yes, doing that would be a good thing.  What you point out does leave a dangling<br></div><div>channel pointer in data->chan_old_vsrc if the pointer is not set to NULL.  Please<br></div><div>create an issue for the dangling pointer.  The patch needs to be done for v13+.<br></div><div><br></div><div>Richard<br></div></div><br></div></div>