Casting Void Pointer to structure changes data
{
static void* data;
func ->
structure* s = new structure();
// do stuff
data = s;
return;
Callback ->
structure* s = (structure*) data;
// Error
}
Functions are more or less setup as above. This setup is used in many locations on the code, works just fine. But for some reason in one spot, the casting overwrites data in the structure that had memory allocated to it.
The assembly for each cast is generated as

Which, I dont understand why a cast needs to str data. By chance perhaps, it doesnt corrupt data anywhere else. I still have plenty of memory left as well, so its not like ive ran out.
