[gnome-control-center] Initialize autoptr values to NULL.



commit 9a2e821fe50badc78c6a8ca89334b383d953c36c
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Oct 3 10:55:28 2019 +1300

    Initialize autoptr values to NULL.
    
    These cases were safe, but if the code changed this risked freeing uninitialized
    memory.

 panels/display/cc-display-panel.c       | 2 +-
 panels/info-overview/info-cleanup.c     | 2 +-
 panels/network/cc-wifi-panel.c          | 2 +-
 panels/power/cc-power-panel.c           | 6 +++---
 panels/printers/pp-new-printer-dialog.c | 2 +-
 panels/thunderbolt/cc-bolt-panel.c      | 2 +-
 shell/cc-panel-loader.c                 | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index 03dad5b27..b20617f21 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -343,7 +343,7 @@ monitor_labeler_show (CcDisplayPanel *self)
 static void
 ensure_monitor_labels (CcDisplayPanel *self)
 {
-  g_autoptr(GList) windows;
+  g_autoptr(GList) windows = NULL;
   GList *w;
 
   windows = gtk_window_list_toplevels ();
diff --git a/panels/info-overview/info-cleanup.c b/panels/info-overview/info-cleanup.c
index 9c2239523..eb81c9b4c 100644
--- a/panels/info-overview/info-cleanup.c
+++ b/panels/info-overview/info-cleanup.c
@@ -122,7 +122,7 @@ remove_duplicate_whitespace (const char *old)
 char *
 info_cleanup (const char *input)
 {
-  g_autofree char *pretty;
+  g_autofree char *pretty = NULL;
 
   pretty = prettify_info (input);
   return remove_duplicate_whitespace (pretty);
diff --git a/panels/network/cc-wifi-panel.c b/panels/network/cc-wifi-panel.c
index 4e80effa6..c75a4d4ba 100644
--- a/panels/network/cc-wifi-panel.c
+++ b/panels/network/cc-wifi-panel.c
@@ -222,7 +222,7 @@ static inline gboolean
 get_cached_rfkill_property (CcWifiPanel *self,
                             const gchar *property)
 {
-  g_autoptr (GVariant) result;
+  g_autoptr(GVariant) result = NULL;
 
   result = g_dbus_proxy_get_cached_property (self->rfkill_proxy, property);
   return result ? g_variant_get_boolean (result) : FALSE;
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index f213bbae5..1cc689f27 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -1260,9 +1260,9 @@ static char *
 time_to_string_text (gint64 msecs)
 {
        int sec, min, hour, _time;
-       g_autofree gchar *hours;
-       g_autofree gchar *mins;
-       g_autofree gchar *secs;
+       g_autofree gchar *hours = NULL;
+       g_autofree gchar *mins = NULL;
+       g_autofree gchar *secs = NULL;
 
        _time = (int) (msecs / 1000);
        sec = _time % 60;
diff --git a/panels/printers/pp-new-printer-dialog.c b/panels/printers/pp-new-printer-dialog.c
index 651c0d8f3..98acaf6fc 100644
--- a/panels/printers/pp-new-printer-dialog.c
+++ b/panels/printers/pp-new-printer-dialog.c
@@ -1607,7 +1607,7 @@ search_address (const gchar        *text,
 
       if (text && text[0] != '\0')
         {
-          g_autoptr(GSocketConnectable) conn;
+          g_autoptr(GSocketConnectable) conn = NULL;
           gchar *scheme = NULL;
           gchar *host = NULL;
           gint   port;
diff --git a/panels/thunderbolt/cc-bolt-panel.c b/panels/thunderbolt/cc-bolt-panel.c
index 10570e168..81a875b03 100644
--- a/panels/thunderbolt/cc-bolt-panel.c
+++ b/panels/thunderbolt/cc-bolt-panel.c
@@ -615,7 +615,7 @@ on_authmode_ready (GObject      *source_object,
   ok = bolt_client_set_authmode_finish (BOLT_CLIENT (source_object), res, &error);
   if (!ok)
     {
-      g_autofree char *text;
+      g_autofree char *text = NULL;
 
       g_warning ("Could not set authmode: %s", error->message);
 
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index b137adaf2..b894370ed 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -227,7 +227,7 @@ cc_panel_loader_fill_model (CcShellModel *model)
 
   for (i = 0; i < panels_vtable_len; i++)
     {
-      g_autoptr (GDesktopAppInfo) app;
+      g_autoptr(GDesktopAppInfo) app = NULL;
       g_autofree gchar *desktop_name = NULL;
       gint category;
 


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