No, in that example you are returning a pointer to a string literal. The string literal is in read only memory and will not be overwritten by anything.
In your previous example you are returning a pointer to a local variable. This could be overwritten on other adjacent function calls and is probably undefined or implementation specific.
As vart said, you should use malloc to create your array on the heap or you can supply the function with the variable and fill it then.