[grilo] core: Do not access freed structure



commit 28049b1d2990382a4de28b5b1affa9c312ee134c
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Tue Oct 16 11:25:43 2012 +0000

    core: Do not access freed structure
    
    Save the value in a variable because the struct can be freed.

 src/grl-source.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/grl-source.c b/src/grl-source.c
index d12d017..664b862 100644
--- a/src/grl-source.c
+++ b/src/grl-source.c
@@ -2629,6 +2629,7 @@ static gboolean
 store_metadata_idle (gpointer user_data)
 {
   GrlSourceStoreMetadataSpec *sms;
+  gboolean stop;
   struct StoreMetadataRelayCb *smrc;
 
   GRL_DEBUG (__FUNCTION__);
@@ -2647,9 +2648,10 @@ store_metadata_idle (gpointer user_data)
   smrc->use_sources = g_list_remove_link (smrc->use_sources, smrc->use_sources);
   smrc->specs = g_list_prepend (smrc->specs, sms);
 
+  stop = smrc->use_sources == NULL;
   GRL_SOURCE_GET_CLASS (sms->source)->store_metadata (sms->source, sms);
 
-  return (smrc->use_sources != NULL);
+  return !stop;
 }
 
 static void



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