1 // leak.cpp : Defines the entry point for the console application.
5 #include <sys/socket.h>
10 unsigned long int atoip(const char * str)
13 struct addrinfo *addrInfo, hints;
15 memset(&hints, 0, sizeof(hints));
16 hints.ai_family = AF_INET;
18 int res = getaddrinfo(str, NULL, &hints, &addrInfo);
22 for (struct addrinfo *ai = addrInfo; ai; ai = ai->ai_next)
24 if ((ai->ai_family == AF_INET) && (ai->ai_addrlen ==
25 sizeof(struct sockaddr_in)))
27 struct sockaddr_in *addr = (struct sockaddr_in*)ai->ai_addr;
29 unsigned long a = addr->sin_addr.s_addr;
30 freeaddrinfo(addrInfo);
36 freeaddrinfo(addrInfo);
42 int main(int argc, char* argv[])
44 //std::cout << MegaFunc("Hello world!").c_str();
45 //std::cout << MegaLeak2("127.0.0.1");
46 //std::cout << atoip(L"127.0.0.1") << std::endl;
47 while(atoip("localhost")!=3)
50 // std::cout << atoip(L"localhost") << std::endl;