I believe there has been an error of thinking the word pointee refers to the variable doing the pointing (subject), rather than the thing being pointed to (object). In chapter 4, the sentence "undefined behavior: pointer used after its pointee is freed" is used in multiple of the diagrams showing how values/pointers in the stack and heap change. However, in some of the diagrams it is not the pointee (the data on the heap) that has been freed, but a variable pointing to the data.
Suggested fix:
Change "undefined behavior: pointer used after its pointee is freed" to "undefined behavior: pointer used after it has been freed" or "undefined behavior: pointer used after the pointing variable has been freed" in diagrams where the pointer is freed and the heap data remains.
To be clear, first itself is not freed. It is a stack variable, so its memory is still live. Its pointee, the heap string that used to contain "Ferris", has been freed. Hence the error message.
I have searched open and closed issues and pull requests for duplicates, using these search terms:
I have checked the latest
main
branch to see if this has already been fixed, in this file:URL to the section(s) of the book with this problem:
Description of the problem:
I believe there has been an error of thinking the word pointee refers to the variable doing the pointing (subject), rather than the thing being pointed to (object). In chapter 4, the sentence "undefined behavior: pointer used after its pointee is freed" is used in multiple of the diagrams showing how values/pointers in the stack and heap change. However, in some of the diagrams it is not the pointee (the data on the heap) that has been freed, but a variable pointing to the data.
Wiktionary's definition of pointee.
Suggested fix: Change "undefined behavior: pointer used after its pointee is freed" to "undefined behavior: pointer used after it has been freed" or "undefined behavior: pointer used after the pointing variable has been freed" in diagrams where the pointer is freed and the heap data remains.