Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 700f0af commit ea5942bCopy full SHA for ea5942b
src/posix.c
@@ -62,7 +62,10 @@ int p_getaddrinfo(
62
ai = ainfo;
63
64
for (p = 1; ainfo->ai_hostent->h_addr_list[p] != NULL; p++) {
65
- ai->ai_next = malloc(sizeof(struct addrinfo));
+ if (!(ai->ai_next = malloc(sizeof(struct addrinfo)))) {
66
+ p_freeaddrinfo(ainfo);
67
+ return -1;
68
+ }
69
memcpy(&ai->ai_next, ainfo, sizeof(struct addrinfo));
70
memcpy(&ai->ai_next->ai_addr_in.sin_addr,
71
ainfo->ai_hostent->h_addr_list[p],
0 commit comments