Removed buffer copy, still fixes memory leak.