"port" was allocated dynamically but never freed. Fix it by
using a static buffer instead. This buffer can not overflow as
"port_number" is an unsigned short, so its decimal representation
consists of at most 5 digits.
{
struct addrinfo *local = NULL, *src,
*remote = NULL, *dst, hints;
{
struct addrinfo *local = NULL, *src,
*remote = NULL, *dst, hints;
- char *port = make_message("%u", port_number);
int rc, on = 1, sockfd = -1,
socktype = sock_type(l4type);
int rc, on = 1, sockfd = -1,
socktype = sock_type(l4type);
+ char port[6]; /* port number has at most 5 digits */
+ sprintf(port, "%u", port_number);
/* Set up address hint structure */
memset(&hints, 0, sizeof(hints));
hints.ai_family = l3type;
/* Set up address hint structure */
memset(&hints, 0, sizeof(hints));
hints.ai_family = l3type;