Nice work Azer!
However, you are leaking memory from this line, because of getaddrinfo():
|
if (getaddrinfo(argv[1], NULL, &hints, &res) != 0) { |
From the man page:
The getaddrinfo() function allocates and initializes a linked list of addrinfo structures, one for each network address that matches node and service, subject to any restrictions imposed by hints, and returns a pointer to the start of the list in res. The items in the linked list are linked by the ai_next field.
Fix:
Call freeaddrinfo() on error and before exiting the process.
The freeaddrinfo() function frees the memory that was allocated for the dynamically allocated linked list res.
Nice work Azer!
However, you are leaking memory from this line, because of
getaddrinfo():ft_ping/srcs/main.c
Line 92 in cfbdf60
From the
manpage:Fix:
Call
freeaddrinfo()on error and before exiting the process.