Replace this: close(fd); fd = -1; write this: fd = safe_close(fd);
This replaces this: free(p); p = NULL; by this: p = mfree(p); Change generated using coccinelle. Semantic patch is added to the sources.