[gvfs] Fix use of uninitialized values



commit bf5493fc31ca6555390a076d7ce18872b7c0c0ec
Author: Tomas Bzatek <tbzatek redhat com>
Date:   Fri Dec 7 17:00:42 2012 +0100

    Fix use of uninitialized values

 common/gmountspec.c         |    2 +-
 common/gvfsdaemonprotocol.c |   13 +++++++++++--
 daemon/gvfsafpconnection.c  |    2 +-
 3 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/common/gmountspec.c b/common/gmountspec.c
index 1e34d79..ac9b66c 100644
--- a/common/gmountspec.c
+++ b/common/gmountspec.c
@@ -494,7 +494,7 @@ g_mount_spec_new_from_string (const gchar     *str,
       item.value = g_uri_unescape_string (tokens[1], NULL);
       if (strcmp (tokens[0], "prefix") == 0)
         {
-          g_free (item.key);
+          g_free (mount_prefix);
           mount_prefix = item.value;
         }
       else
diff --git a/common/gvfsdaemonprotocol.c b/common/gvfsdaemonprotocol.c
index a77e996..6485854 100644
--- a/common/gvfsdaemonprotocol.c
+++ b/common/gvfsdaemonprotocol.c
@@ -277,6 +277,8 @@ _g_dbus_get_file_attribute (GVariant *value,
   else if (g_variant_is_container (v))
     {
       *type = G_FILE_ATTRIBUTE_TYPE_OBJECT;
+      obj_type = G_MAXUINT32;   /* treat it as an error if not set below */
+      str = NULL;
 
       if (g_variant_is_of_type (v, G_VARIANT_TYPE ("(u)")))
         {
@@ -292,8 +294,15 @@ _g_dbus_get_file_attribute (GVariant *value,
       /* obj_type 1 and 2 are deprecated and treated as errors */
       if (obj_type == 3)
         {
-          /* serialized G_ICON */
-          obj = (GObject *)g_icon_new_for_string (str, NULL);
+          if (str != NULL)
+            {
+              /* serialized G_ICON */
+              obj = (GObject *)g_icon_new_for_string (str, NULL);
+            }
+          else
+            {
+              g_warning ("Malformed object data in file attribute");
+            }
         }
       else
         {
diff --git a/daemon/gvfsafpconnection.c b/daemon/gvfsafpconnection.c
index 5233270..58291f8 100644
--- a/daemon/gvfsafpconnection.c
+++ b/daemon/gvfsafpconnection.c
@@ -1774,7 +1774,7 @@ open_thread_func (gpointer user_data)
   GSocketClient *client;
 
   guint16 req_id;
-  gboolean res;
+  gboolean res = FALSE;
   char *reply;
   DSIHeader dsi_header;
   guint pos;



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