This is used in a lot of places to temporarily create a new entry that needs to be carefully deleted (maybe). How about creating a version that simply copies the values so you can populate a struct in the stack or simply copies them to a number of output variables or something?  I think I've spotted two memory leaks already. This approach might help.