-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Nice work Azer!
However, you are leaking memory from this line, because of getaddrinfo():
Line 92 in cfbdf60
| 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.
AzerSD
Metadata
Metadata
Assignees
Labels
No labels