Is struct addrinfo **res allocated when getaddrinfo() returns a non-zero value?

Viewed 1752

I am having some memory leaking troubles in an embedded application and while looking in the code, I see I do not freeaddrinfo() when getaddrinfo() returns non-zero:

s = getaddrinfo(hostname, port, &hints, &result);
if (s != 0) {
  log_error();
} else {
  // do stuff
  freeaddrinfo(result);
}

Could this lead to memory leaks? I have tried to look into the man page, but it doesn't state it explicitly.

2 Answers
Related