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.

Also, format the commit message as per guidelines at:


Reply to this email directly or view it on GitHub.