[gvfs] Prevent access to unitialized memory



commit d34a750e152412b31bd5d7a1311ea7c06d37631b
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Sep 11 01:05:03 2009 -0400

    Prevent access to unitialized memory
    
    This has been reported by clang.

 monitor/proxy/gproxymountoperation.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/monitor/proxy/gproxymountoperation.c b/monitor/proxy/gproxymountoperation.c
index 6dc286a..5e8620c 100644
--- a/monitor/proxy/gproxymountoperation.c
+++ b/monitor/proxy/gproxymountoperation.c
@@ -326,6 +326,7 @@ g_proxy_mount_operation_handle_show_processes (const gchar      *wrapped_id,
   g_return_if_fail (iter != NULL);
 
   choices = NULL;
+  processes = NULL;
 
   G_LOCK (proxy_op);
   data = g_hash_table_lookup (id_to_op, wrapped_id);
@@ -382,8 +383,10 @@ g_proxy_mount_operation_handle_show_processes (const gchar      *wrapped_id,
                          choices->pdata);
 
  out:
-  g_ptr_array_free (choices, TRUE);
-  g_array_unref (processes);
+  if (choices)
+    g_ptr_array_free (choices, TRUE);
+  if (processes)
+    g_array_unref (processes);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */



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