Given a pointer to some variable.. is there a way to check whether it was statically or dynamically allocated??
You can compare its address to something you know to be static, and say it's malloced only if it's far away, if you know the scope it should be coming from, but if its scope is unknown, you can't really trust that.