You didn’t actually allocate any memory, neither on the stack nor on the heap. You’re just pointing your variable at an address and then pretend that the memory there belongs to you.
This is not legal in either C or C++ and will generally not work. And “not work” can really mean anything here. And since the code is illegal, the question of whether the pointer can be free
d is moot.
(In very specific settings, if the compiler and the hardware supports it, this is used to write to specific hardware addresses. But this isn’t the case here.)