fixed a huge memory leak (buffer the size of the entire code stream)