From: Bryan Cain <bryanca...@gmail.com>

Before, it accounted for the size of the vertices but not the other fields
in the vertex_header struct, which caused memory corruption.

Reviewed-by: Zack Rusin <za...@vmware.com>
---
 src/gallium/auxiliary/draw/draw_gs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c 
b/src/gallium/auxiliary/draw/draw_gs.c
index 5c55523..2ce1a2a 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -401,7 +401,8 @@ int draw_geometry_shader_run(struct draw_geometry_shader 
*shader,
    output_verts->vertex_size = input_verts->vertex_size;
    output_verts->stride = input_verts->vertex_size;
    output_verts->verts =
-      (struct vertex_header *)MALLOC(input_verts->vertex_size *
+      (struct vertex_header *)MALLOC(sizeof(struct vertex_header) +
+                                     input_verts->vertex_size *
                                      num_in_primitives *
                                      shader->max_output_vertices);
 
-- 
1.7.10.4
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to