getaddrinfo memory leak

前端 未结 3 1686
我寻月下人不归
我寻月下人不归 2020-12-17 10:32

I have this code for getting information about IPv4 address:

struct addrinfo hints, *info = NULL;
char addr4[INET_ADDRSTRLEN];

memset(&hints, 0, sizeof(h         


        
3条回答
  •  情书的邮戳
    2020-12-17 11:25

    This may not be a memory leak (technically it is, but you shouldn't worry about it) sometimes libraries allocate memory the first time a function is called for subsequent calls. you can have valgrind suppress those errors if you want.

    From the FAQ:

    "still reachable" means your program is probably ok -- it didn't free some memory it could have. This is quite common and often reasonable. Don't use --show-reachable=yes if you don't want to see these reports.

提交回复
热议问题