strdup() is a library function, so you need to go back to backtrace until you find the caller in your code. There you will find the library call, as a result of which memory is allocated - it should have a corresponding release call in another place of your program.
(The release function is not necessarily a direct call to free() - for example, if you call the library function getaddrinfo() , the corresponding release function is freeaddrinfo() ).
source share