在什么地方 namestr 与其它地址数值一起被编写,从而丢失分配在 main() 中的最后一个内存指针,最终导致渗漏吗?
Where exactly does namestr get written with another address value, and thereby lose the last pointer to memory allocated in main(), causing the leak?
当strdup在foo中被调用,这个namestr变量值就会被覆写,从而丢失main中内存分配的指针,导致渗漏。
When strdup is called in foo , the namestr variable value is overwritten, thereby losing the pointer to the memory allocated in main , and that causes the leak.
明显丢失或“内存泄漏”:最坏的结果是某些块已没有指针指向,却还能被发现。
Definitely lost, or "leaked" : Theworst outcome is that no pointer to the block can be found.
应用推荐