You are correct. Memory is freed, though if you try to write there after that function, it might work, but don't count on it. Later it will probably be re-used for something else and you'll not get the result you were expecting from that variable.
Returning a reference to a local variable is sort of "undefined behaviour." You don't know what's going to happen, so don't do it.