[babl] babl: always allocate enough memory



commit 2244f4a7d648b02192d0d23b82567717daa499e3
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Wed Dec 5 19:22:36 2012 +0100

    babl: always allocate enough memory

 babl/babl-fish-reference.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/babl/babl-fish-reference.c b/babl/babl-fish-reference.c
index 05bdc87..abb1b48 100644
--- a/babl/babl-fish-reference.c
+++ b/babl/babl-fish-reference.c
@@ -289,9 +289,12 @@ process_same_model (const Babl      *babl,
       babl_log ("args=(%p, %p, %p, %li): trying to handle BablImage (unconfirmed code)",
                 babl_fish, source, destination, n);
     }
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
 
   double_buf = babl_malloc (sizeof (double) * n *
-                            BABL (babl->fish.source)->format.model->components);
+                            MAX (BABL (babl->fish.source)->format.model->components,
+                                 BABL (babl->fish.source)->format.components));
+#undef MAX
 
   if (
       (BABL (babl->fish.source)->format.components ==



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