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 .
当strdup()在foo()中被调用,这个namestr变量值就会被覆写,从而丢失main()中内存分配的指针,导致渗漏。