Skip to content

Latest commit

 

History

History
1 lines (1 loc) · 336 Bytes

12.13.md

File metadata and controls

1 lines (1 loc) · 336 Bytes

The code is error. The memory pointed by smart pointer sp is freed by delete p;, and sp becomes a dangling pointer. It will cause some problems. We cannot dereference any one of the shared pointers which point to the same memory that sp pointed, and when all these shared pointers are destoryed, the memory will be freed again.