[farsight2/master] Cleanup mappings

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


---
 fs-upnp-simple-igd.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/fs-upnp-simple-igd.c b/fs-upnp-simple-igd.c
index 2511d84..d2577b9 100644
--- a/fs-upnp-simple-igd.c
+++ b/fs-upnp-simple-igd.c
@@ -113,6 +113,7 @@ static void fs_upnp_simple_igd_add_proxy_mapping (FsUpnpSimpleIgd *self,
     struct Mapping *mapping);
 
 static void free_proxy (struct Proxy *prox);
+static void free_mapping (struct Mapping *mapping);
 
 static void stop_proxymapping (struct ProxyMapping *pm);
 
@@ -196,6 +197,13 @@ fs_upnp_simple_igd_dispose (GObject *object)
     g_signal_handler_disconnect (self->priv->cp, self->priv->unavail_handler);
   self->priv->unavail_handler = 0;
 
+  while (self->priv->mappings)
+  {
+    free_mapping (
+        g_ptr_array_index (self->priv->mappings, 0));
+    g_ptr_array_remove_index_fast (self->priv->mappings, 0);
+  }
+
   while (self->priv->service_proxies->len)
   {
     free_proxy (
@@ -540,6 +548,7 @@ fs_upnp_simple_igd_remove_port (FsUpnpSimpleIgd *self,
   }
   g_return_if_fail (mapping);
 
+  g_ptr_array_remove_index_fast (self->priv->mappings, i);
 
   for (i=0; i < self->priv->service_proxies->len; i++)
   {
-- 
1.5.6.5




More information about the farsight-commits mailing list