[gegl] Bug 742306: Invalid read of size 8 executing gegl:matting-global



commit ad4682a3e98dca23c6b95e7009e00d838590864b
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Mon Jan 12 19:09:01 2015 +0100

    Bug 742306: Invalid read of size 8 executing gegl:matting-global
    
    fix a typo and a memory leak

 operations/common/matting-global.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/operations/common/matting-global.c b/operations/common/matting-global.c
index 57ee2a4..d57c789 100644
--- a/operations/common/matting-global.c
+++ b/operations/common/matting-global.c
@@ -242,8 +242,8 @@ static inline void do_random_search(GArray *foreground_samples, GArray *backgrou
       // Get new indices to check
       int fl = foreground_samples->len;
       int bl = background_samples->len;
-      int fi = (start_fi + (rand() % (dist_f * 2 + 1)) + fl - dist_f) % fl;
-      int bi = (start_bi + (rand() % (dist_b * 2 + 1)) + fl - dist_b) % bl;
+      int fi = (start_fi + (rand () % (dist_f * 2 + 1)) + fl - dist_f) % fl;
+      int bi = (start_bi + (rand () % (dist_b * 2 + 1)) + bl - dist_b) % bl;
 
       ColorSample foreground = g_array_index(foreground_samples, ColorSample, fi);
       ColorSample background = g_array_index(background_samples, ColorSample, bi);
@@ -463,9 +463,9 @@ cleanup:
   g_free (trimap);
   g_free (output);
   g_free (buffer);
-  g_array_free(foreground_samples, FALSE);
-  g_array_free(background_samples, FALSE);
-  g_array_free(unknown_positions, FALSE);
+  g_array_free (foreground_samples, TRUE);
+  g_array_free (background_samples, TRUE);
+  g_array_free (unknown_positions, TRUE);
 
   return success;
 }


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