[cogl/cogl-1.14] Fix a clear of an array allocated with alloca which had the wrong size



commit 1e39819c4939f47c9b7a6c80b174de4941b11187
Author: Neil Roberts <neil linux intel com>
Date:   Wed Feb 6 11:34:42 2013 +0000

    Fix a clear of an array allocated with alloca which had the wrong size
    
    The array allocated for storing the difference flags for each layer in
    cogl-pipeline-opengl.c was being cleared with the size of a pointer
    instead of the size actually allocated for the array. Presumably this
    would mean that if there is more than one layer it wouldn't clear the
    array properly.
    
    Also the size of the array was slightly wrong because it was allocating
    the size of a pointer for each layer instead of the size of an
    unsigned long.
    
    This was originally reported by Jasper St. Pierre on #clutter.
    
    Reviewed-by: Robert Bragg <robert linux intel com>
    
    (cherry picked from commit 1e134dd7cd5317651be158a483c7cb2723ce8869)

 cogl/driver/gl/cogl-pipeline-opengl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/driver/gl/cogl-pipeline-opengl.c
index 166cffb..81d1b28 100644
--- a/cogl/driver/gl/cogl-pipeline-opengl.c
+++ b/cogl/driver/gl/cogl-pipeline-opengl.c
@@ -1195,8 +1195,8 @@ _cogl_pipeline_flush_gl_state (CoglPipeline *pipeline,
   if (n_layers)
     {
       CoglPipelineCompareLayersState state;
-      layer_differences = g_alloca (sizeof (unsigned long *) * n_layers);
-      memset (layer_differences, 0, sizeof (layer_differences));
+      layer_differences = g_alloca (sizeof (unsigned long) * n_layers);
+      memset (layer_differences, 0, sizeof (unsigned long) * n_layers);
       state.i = 0;
       state.layer_differences = layer_differences;
       _cogl_pipeline_foreach_layer_internal (pipeline,


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