Definitely it will leak memory. when a function body ends all local variables are destroyed indicates to the variables that are created in stack, not heap. If you allocate memory in heap, you have to release it when done.
Another thing is your concept about dereference is wrong. Dereference means using the object pointed by a pointer, not freeing the memory of the pointer, which is called Deallocation