[gnome-documents] miner: set parents to NULL to avoid segfault if early "goto out"



commit 5d8feb8d52f123c90a0c981cf2a5e525725e24ad
Author: Alban Browaeys <prahal yahoo com>
Date:   Tue Apr 10 22:00:33 2012 +0200

    miner: set parents to NULL to avoid segfault if early "goto out"
    
    The symptom from this segfault in the miner is gnome-documents telling
    GData dbus timeout (due to service dying without a reply).
    
    parents is freed uninitialized if one of the call to tracker fails
    thus setting error to non null, ie goto out before parents is assigned
    in account_miner_job_process_entry.
    
    The issue which triggered tracker to return a non null error
    disappeared after a run with this fix. I miss a commplete log with
    LIBGDATA_DEBUG=7 and G_MESSAGES_DEBUG="Tracker,Gjs,libgdata".
    
    Still the gdb backtrace with GDATA_MINER_PERSIST=1 showed that the error
    came from:
     alternate = gdata_entry_look_up_link (entry, GDATA_LINK_ALTERNATE);
      alternate_uri = gdata_link_get_uri (alternate);
    
      _tracker_sparql_connection_insert_or_replace_triple
        (job->connection,
         job->cancellable, error,
         identifier, resource,
         "nie:url", alternate_uri);
    
    https://bugzilla.gnome.org/show_bug.cgi?id=673858

 src/miner/gd-gdata-miner.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/miner/gd-gdata-miner.c b/src/miner/gd-gdata-miner.c
index 698fc2b..b60e3d9 100644
--- a/src/miner/gd-gdata-miner.c
+++ b/src/miner/gd-gdata-miner.c
@@ -476,7 +476,7 @@ account_miner_job_process_entry (AccountMinerJob *job,
   gchar *date, *resource_url, *datasource_urn, *identifier;
   const gchar *class = NULL;
 
-  GList *authors, *l, *parents;
+  GList *authors, *l, *parents = NULL;
   GDataAuthor *author;
   GDataLink *parent;
 
@@ -713,8 +713,7 @@ account_miner_job_process_entry (AccountMinerJob *job,
   g_free (resource);
   g_free (identifier);
 
-  if (parents != NULL)
-    g_list_free (parents);
+  g_list_free (parents);
 
   if (*error != NULL)
     return FALSE;



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