Fixed the spinning and the memory leak. Stupid buffer allocations.