Updated stream_buffer.h to fix mem allocation issues