In this article I will present to you a safe wrapper for freeing memory allocated with *alloc family functions. The standard function “void free (void * pointer)” from stdlib library does not check the given pointer to see whether it is NULL and does not NULL terminate the pointer before it returns either. So, setting a pointer to NULL after freeing is considered a good practice, and can reduce the chances of unpredictable behavior if the memory is later accessed; segmentation faults when the memory is no longer accessible and potential security risks.
Tag Archive: macro
Macro definitions for handling interruptible POSIX system calls.
October 16, 2014
In this article I will present to you some macro definitions for handling interruptible system calls.