A reference to a newly instantiated (in function 'A') object is passed in a call to another function, 'B', that places it into an STL map. The called function and the calling function return, the calling thread completes its work and awaits further input. After a while the calling thread runs again and function 'A' creates another object identical to the first. Once more, function 'B' puts the object into the map. Because the new object has the same key as the old object, it overwrites the old object in the map.
Is the old object destroyed when it gets overwritten, or is htere a memory leak here?