[gupnp-tools] network-light: Fix some memory leaks



commit 71c6fd0fe63290c2766010b67ac0e7cac45b8304
Author: Jens Georg <mail jensge org>
Date:   Sat Jul 25 21:20:01 2020 +0200

    network-light: Fix some memory leaks

 src/network-light/main.c |  4 ++++
 src/network-light/upnp.c | 10 +++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/network-light/main.c b/src/network-light/main.c
index 5d535a2..7cb1eb0 100644
--- a/src/network-light/main.c
+++ b/src/network-light/main.c
@@ -108,9 +108,13 @@ main (int argc, char **argv)
         if (!g_option_context_parse (context, &argc, &argv, &error)) {
                 g_print (_("Could not parse options: %s\n"), error->message);
 
+                g_option_context_free (context);
+
                 return -4;
         }
 
+        g_option_context_free (context);
+
         if (!init_ui (&argc, &argv, name, exclusive)) {
                 return -1;
         }
diff --git a/src/network-light/upnp.c b/src/network-light/upnp.c
index 1b5dadf..193eba5 100644
--- a/src/network-light/upnp.c
+++ b/src/network-light/upnp.c
@@ -158,6 +158,8 @@ notify_status_change (gboolean status)
                                       status,
                                       NULL);
         }
+
+        g_list_free (network_lights);
 }
 
 void
@@ -179,6 +181,8 @@ notify_load_level_change (gint load_level)
                                       load_level,
                                       NULL);
         }
+
+        g_list_free (network_lights);
 }
 
 G_MODULE_EXPORT
@@ -481,7 +485,7 @@ set_all_status (gboolean status)
                         action,
                         NULL,
                         on_service_proxy_action_ret,
-                        NULL);
+                        action_name);
                 gupnp_service_proxy_action_unref (action);
         }
 }
@@ -584,11 +588,15 @@ on_network_light_unavailable (GUPnPControlPoint *control_point,
                 remove_service_from_list (info, &switch_proxies);
         }
 
+        g_clear_object (&info);
+
         info = gupnp_device_info_get_service (GUPNP_DEVICE_INFO (light_proxy),
                                               DIMMING_SERVICE);
         if (info) {
                 remove_service_from_list (info, &dimming_proxies);
         }
+
+        g_clear_object (&info);
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]