Initialize autoptr values to NULL.

These cases were safe, but if the code changed this risked freeing uninitialized
memory.
This commit is contained in:
Robert Ancell 2019-10-03 10:55:28 +13:00
parent c6965d9e30
commit 9a2e821fe5
7 changed files with 9 additions and 9 deletions

View file

@ -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 ();

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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;