[frogr] Fixed memory corruption when loaded pictures are too big.



commit a2e570a21f2e8725de64f451608c8c18f4b1d11e
Author: Mario Sanchez Prada <msanchez igalia com>
Date:   Mon Aug 15 01:53:05 2011 +0200

    Fixed memory corruption when loaded pictures are too big.
    
    This was causing the app to segfault under certain scenarios, and this
    "fix" solves the issue, although it would be worth it to invest some
    time investigating properly this issue since it could be that more
    memory corruptions or leaks were happening in the picture loader.
    
    Still, this is a good enough fix for the time being :-)

 src/frogr-picture-loader.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/frogr-picture-loader.c b/src/frogr-picture-loader.c
index 06b7be1..37061c6 100644
--- a/src/frogr-picture-loader.c
+++ b/src/frogr-picture-loader.c
@@ -427,6 +427,7 @@ _load_next_picture_cb (GObject *object,
       g_free (file_name);
     }
 
+  g_free (contents);
   g_object_unref (file);
 
   /* Update internal status */
@@ -440,14 +441,14 @@ _load_next_picture_cb (GObject *object,
   if (priv->picture_loaded_cb && fpicture)
     keep_going = priv->picture_loaded_cb (priv->object, fpicture);
 
-  /* Free memory */
-  g_free (contents);
-  if (fpicture != NULL)
-    g_object_unref (fpicture);
-
   /* Go for the next picture, if needed */
   if (keep_going)
+    {
+      if (fpicture != NULL)
+        g_object_unref (fpicture);
+
     _load_next_picture (self);
+    }
   else
     {
       /* Execute final callback */



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