I changed it to this, but the debug window says HEAP[Punteros.exe]: Invalid Address specified to RtlFreeHeap( 00390000, 0012FF74 )
Windows has triggered a breakpoint in Punteros.
> it fails under debug configurations, not happening under release config.
That and its converse - "my code works correctly with a debug build, but fails with a release build" - is one of the most common manifestations of 'undefined behaviour'.
fixed, now I know, that, "variable" is not inside the free store, so I can't make a reference with the use of the "&" operand, it means that, everytime i need to allocate to the free store i should use the "new" operand?
pLocal= &variable;
This line is valid, you are pointing to memory on the stack. Just set it to null when you are done with the pointer.
@cire
I dont see how it is a memory leak, a dangling pointer yes if variable goes out of scope.