Fixed a bug with FunctionNamer deallocating invalid pointers

I changed the naming behavior so that setting a new function name will work
correctly when dealing with the old one.