...
This function increments the value pointed to by its argument. It also ensures that its argument is not a null pointer. But the pointer can still be invalid, causing the function to corrupt memory and terminate abnormally.
| Code Block | ||
|---|---|---|
| ||
void incr(int *intptr) {
if (intptr == NULL) {
/* handle error */
}
*intptr++;
}
|
...