Renamed c-ares setup.h to ares_setup.h
[platform/upstream/c-ares.git] / ares_free_hostent.c
1 /* $Id$ */
2
3 /* Copyright 1998 by the Massachusetts Institute of Technology.
4  *
5  * Permission to use, copy, modify, and distribute this
6  * software and its documentation for any purpose and without
7  * fee is hereby granted, provided that the above copyright
8  * notice appear in all copies and that both that copyright
9  * notice and this permission notice appear in supporting
10  * documentation, and that the name of M.I.T. not be used in
11  * advertising or publicity pertaining to distribution of the
12  * software without specific, written prior permission.
13  * M.I.T. makes no representations about the suitability of
14  * this software for any purpose.  It is provided "as is"
15  * without express or implied warranty.
16  */
17
18 #include "ares_setup.h"
19 #include <stdlib.h>
20
21 #if !defined(WIN32) || defined(WATT32)
22 #include <netdb.h>
23 #endif
24
25 #include "ares.h"
26 #include "ares_private.h" /* for memdebug */
27
28 void ares_free_hostent(struct hostent *host)
29 {
30   char **p;
31
32   free((char *)(host->h_name));
33   for (p = host->h_aliases; *p; p++)
34     free(*p);
35   free(host->h_aliases);
36   free(host->h_addr_list[0]); /* no matter if there is one or many entries,
37                                  there is only one malloc for all of them */
38   free(host->h_addr_list);
39   free(host);
40 }