Safer FREE()
#define safeFree(p) saferFree((void**)&(p))
void saferFree(void **pp) {
if (pp != NULL && *pp != NULL) {
free(*pp);
*pp = NULL;
}
}
Fonte: Richard Reese. Understanding and Using C Pointers. O'Reilly, 2013.
#define safeFree(p) saferFree((void**)&(p))
void saferFree(void **pp) {
if (pp != NULL && *pp != NULL) {
free(*pp);
*pp = NULL;
}
}
Fonte: Richard Reese. Understanding and Using C Pointers. O'Reilly, 2013.