[aravis] gv_interface: correctly free data from getifaddrs.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis] gv_interface: correctly free data from getifaddrs.
- Date: Sun, 16 Oct 2011 19:09:46 +0000 (UTC)
commit 02551437478424cb667bc3bc5bd394d60deb64f6
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Sun Oct 16 21:06:23 2011 +0200
gv_interface: correctly free data from getifaddrs.
src/arvgvinterface.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/arvgvinterface.c b/src/arvgvinterface.c
index 65d1788..e256d5b 100644
--- a/src/arvgvinterface.c
+++ b/src/arvgvinterface.c
@@ -119,6 +119,7 @@ static void
arv_gv_interface_build_discover_infos_list (ArvGvInterface *gv_interface)
{
struct ifaddrs *ifap = NULL;
+ struct ifaddrs *ifap_iter;
int return_value;
arv_gv_interface_free_discover_infos_list (gv_interface);
@@ -127,17 +128,18 @@ arv_gv_interface_build_discover_infos_list (ArvGvInterface *gv_interface)
if (return_value < 0)
return;
- for (;ifap != NULL; ifap = ifap->ifa_next) {
- if ((ifap->ifa_flags & IFF_UP) != 0 &&
- (ifap->ifa_flags & IFF_POINTOPOINT) == 0 &&
- (ifap->ifa_addr->sa_family == AF_INET)) {
+ for (ifap_iter = ifap; ifap_iter != NULL; ifap_iter = ifap_iter->ifa_next) {
+ if ((ifap_iter->ifa_flags & IFF_UP) != 0 &&
+ (ifap_iter->ifa_flags & IFF_POINTOPOINT) == 0 &&
+ (ifap_iter->ifa_addr->sa_family == AF_INET)) {
ArvGvInterfaceDiscoverInfos *infos = g_new (ArvGvInterfaceDiscoverInfos, 1);
GSocketAddress *socket_address;
GInetAddress *inet_address;
char *inet_address_string;
GError *error = NULL;
- socket_address = g_socket_address_new_from_native (ifap->ifa_addr, sizeof (struct sockaddr));
+ socket_address = g_socket_address_new_from_native (ifap_iter->ifa_addr,
+ sizeof (struct sockaddr));
inet_address = g_inet_socket_address_get_address (G_INET_SOCKET_ADDRESS (socket_address));
inet_address_string = g_inet_address_to_string (inet_address);
arv_debug_interface ("[GvInterface::build_discover_infos_list] Add interface %s",
@@ -146,7 +148,7 @@ arv_gv_interface_build_discover_infos_list (ArvGvInterface *gv_interface)
infos->interface_address = g_inet_socket_address_new (inet_address, 0);
g_object_unref (socket_address);
- socket_address = g_socket_address_new_from_native (ifap->ifa_broadaddr,
+ socket_address = g_socket_address_new_from_native (ifap_iter->ifa_broadaddr,
sizeof (struct sockaddr));
inet_address = g_inet_socket_address_get_address (G_INET_SOCKET_ADDRESS (socket_address));
infos->broadcast_address = g_inet_socket_address_new (inet_address, ARV_GVCP_PORT);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]