January 2020
Intermediate to advanced
454 pages
11h 25m
English
The ability to detect memory leaks is extremely helpful, but it is not the only type of error that can be detected by ASAN. Another common type of error is deleting memory twice. For example, consider the following code snippet:
int main(void){ auto p = new int; delete p; delete p;}
When executed, we see the following output:

In the preceding example, we allocate an integer using the new operator and then delete the integer using the delete operator. Since the pointer to the previously allocated memory is still in our p variable, we can delete it again, which we do before we exit the program. On some systems, this would ...
Read now
Unlock full access