contrib: gpg-error: Provide a lock obj for NACL
[vlc.git] / compat / freeaddrinfo.c
blobfecc3fa7dde3cef3c769afdc710c7156714f759b
1 /*****************************************************************************
2 * freeaddrinfo.c: freeaddrinfo() replacement functions
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
5 * Copyright (C) 2002-2007 Rémi Denis-Courmont
6 * Copyright (C) 2011-2014 KO Myung-Hun
8 * Authors: KO Myung-Hun <komh@chollian.net>
9 * Rémi Denis-Courmont <rem # videolan.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 2.1 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
30 #include <stdlib.h>
33 * This function must be used to free the memory allocated by getaddrinfo().
35 void freeaddrinfo (struct addrinfo *res)
37 while (res != NULL)
39 struct addrinfo *next = res->ai_next;
41 free (res->ai_canonname);
42 free (res->ai_addr);
43 free (res);
44 res = next;