Lines Matching refs:hostent

36 int ares__get_hostent(FILE *fp, int family, struct hostent **host)  in ares__get_hostent()
43 struct hostent *hostent = NULL; in ares__get_hostent() local
169 hostent = malloc(sizeof(struct hostent)); in ares__get_hostent()
170 if (!hostent) in ares__get_hostent()
174 hostent->h_aliases = NULL; in ares__get_hostent()
175 hostent->h_addr_list = NULL; in ares__get_hostent()
178 hostent->h_name = strdup(txthost); in ares__get_hostent()
179 if (!hostent->h_name) in ares__get_hostent()
183 hostent->h_addr_list = malloc(2 * sizeof(char *)); in ares__get_hostent()
184 if (!hostent->h_addr_list) in ares__get_hostent()
186 hostent->h_addr_list[1] = NULL; in ares__get_hostent()
187 hostent->h_addr_list[0] = malloc(addrlen); in ares__get_hostent()
188 if (!hostent->h_addr_list[0]) in ares__get_hostent()
191 memcpy(hostent->h_addr_list[0], &addr.addrV4, sizeof(addr.addrV4)); in ares__get_hostent()
193 memcpy(hostent->h_addr_list[0], &addr.addrV6, sizeof(addr.addrV6)); in ares__get_hostent()
196 hostent->h_aliases = malloc((naliases + 1) * sizeof(char *)); in ares__get_hostent()
197 if (!hostent->h_aliases) in ares__get_hostent()
199 alias = hostent->h_aliases; in ares__get_hostent()
222 hostent->h_addrtype = addr.family; in ares__get_hostent()
223 hostent->h_length = (int)addrlen; in ares__get_hostent()
229 *host = hostent; in ares__get_hostent()
241 if (hostent) in ares__get_hostent()
243 if (hostent->h_name) in ares__get_hostent()
244 free((char *) hostent->h_name); in ares__get_hostent()
245 if (hostent->h_aliases) in ares__get_hostent()
247 for (alias = hostent->h_aliases; *alias; alias++) in ares__get_hostent()
249 free(hostent->h_aliases); in ares__get_hostent()
251 if (hostent->h_addr_list) in ares__get_hostent()
253 if (hostent->h_addr_list[0]) in ares__get_hostent()
254 free(hostent->h_addr_list[0]); in ares__get_hostent()
255 free(hostent->h_addr_list); in ares__get_hostent()
257 free(hostent); in ares__get_hostent()