[farsight2/master] Fix various small memory leaks

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:20:30 PST 2008


---
 tests/check/transmitter/rawudp.c                   |    5 +++--
 transmitters/rawudp/fs-interfaces.c                |    8 +++-----
 transmitters/rawudp/fs-rawudp-stream-transmitter.c |    3 +++
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/tests/check/transmitter/rawudp.c b/tests/check/transmitter/rawudp.c
index d0862c1..678b003 100644
--- a/tests/check/transmitter/rawudp.c
+++ b/tests/check/transmitter/rawudp.c
@@ -326,7 +326,6 @@ GST_START_TEST (test_rawudptransmitter_run_stunserver_dot_org)
   g_value_set_uint (&params[2].value, 5);
 
   run_rawudp_transmitter_test (3, params, FLAG_HAS_STUN);
-
 }
 GST_END_TEST;
 
@@ -363,6 +362,8 @@ GST_START_TEST (test_rawudptransmitter_run_local_candidates)
 
   run_rawudp_transmitter_test (1, params, FLAG_IS_LOCAL);
 
+  g_value_reset (&params[0].value);
+
   fs_candidate_list_destroy (list);
 }
 GST_END_TEST;
@@ -392,7 +393,7 @@ rawudptransmitter_suite (void)
   suite_add_tcase (s, tc_chain);
 
   tc_chain = tcase_create ("rawudptransmitter-stunserver-org");
-  tcase_set_timeout (tc_chain, 10);
+  tcase_set_timeout (tc_chain, 15);
   tcase_add_test (tc_chain, test_rawudptransmitter_run_stunserver_dot_org);
   suite_add_tcase (s, tc_chain);
 
diff --git a/transmitters/rawudp/fs-interfaces.c b/transmitters/rawudp/fs-interfaces.c
index 496dfd0..7fc9146 100644
--- a/transmitters/rawudp/fs-interfaces.c
+++ b/transmitters/rawudp/fs-interfaces.c
@@ -183,12 +183,8 @@ farsight_get_local_ips (gboolean include_loopback)
   struct ifaddrs *ifa, *results;
 
 
-  if (getifaddrs (&results) < 0) {
-    if (errno == ENOMEM)
-      return NULL;
-    else
+  if (getifaddrs (&results) < 0)
       return NULL;
-  }
 
   /* Loop through the interface list and get the IP address of each IF */
   for (ifa = results; ifa; ifa = ifa->ifa_next) {
@@ -215,6 +211,8 @@ farsight_get_local_ips (gboolean include_loopback)
     }
   }
 
+  freeifaddrs (results);
+
   return ips;
 }
 
diff --git a/transmitters/rawudp/fs-rawudp-stream-transmitter.c b/transmitters/rawudp/fs-rawudp-stream-transmitter.c
index 7c42c79..faae8a2 100644
--- a/transmitters/rawudp/fs-rawudp-stream-transmitter.c
+++ b/transmitters/rawudp/fs-rawudp-stream-transmitter.c
@@ -605,6 +605,9 @@ fs_rawudp_stream_transmitter_build (FsRawUdpStreamTransmitter *self,
     g_mutex_unlock (self->priv->sources_mutex);
   }
 
+  g_free (ips);
+  g_free (ports);
+
   return TRUE;
 
  error:
-- 
1.5.6.5




More information about the farsight-commits mailing list