<p>stream.buf is dynamic allocated memory and by changing its value it will crash when freeing it, because it is no longer pointing to the start of allocated memory. If you want to strip empty chars at beginning, then do it without changing the initial value of stream.buf -- e.g., use another variable to copy the value for stream.buf and use that var for moving forward to first non-empty-char.</p>

<p>Also, format the commit message as per guidelines at:</p>

<ul>
<li><a href="http://www.kamailio.org/wiki/devel/github-contributions">http://www.kamailio.org/wiki/devel/github-contributions</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/kamailio/kamailio/pull/319#issuecomment-138806121">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZbSXALpBC2Q99Wtmw1Px5KwNG8SJks5ov82_gaJpZM4F6CSC.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/pull/319#issuecomment-138806121"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>