Example:
void *a = malloc(4);
...
free(a);
...
*a = 5;
In c for example is there a way of catching this error using some kind of system call or something? (assuming this is set up such that it can only be checked at runtime)
if(isalloc (a))
maybe?
I'm wondering because c++ has figured it out somehow, except they have exceptions baked in. Can this be done in c? Perhaps a simple function exists, but I can't find it.