I'm trying to code something that will print an error statement if the user tries to free something never malloc-ed (like if they try to free the address of a local variable declared on the stack).
I'm not quite sure how to approach this other than to try to check if the address of the variable attempted to be freed is in the stack (or check if the address of the variable attempted to be freed is NOT in the heap) -- however, this is difficult because I don't know what memory addresses would separate teh stack from the heap and how to go about finding that out. Any advice?
Thank you!