[ros-diffs] [gedmurphy] 22861: clean up code and use HeapAlloc + fix memory leaks