draw: fix memory leak introduced 7720ce32a
authorNeha Bhende <bhenden@vmware.com>
Thu, 16 May 2019 21:46:00 +0000 (15:46 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 17 May 2019 18:26:48 +0000 (12:26 -0600)
We need to free memory allocation PrimitiveOffsets in draw_gs_destroy().
This fixes memory leak found while running piglit on windows.

Fixes: 7720ce32a ("draw: add support to tgsi paths for geometry streams. (v2)")
Tested with piglit

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/gallium/auxiliary/draw/draw_gs.c

index 6420cfbb2613e8cf40cc5a24b67c235b4f6f5cb6..c752163ee05a7c5dce991188fcb09eee700c7ed1 100644 (file)
@@ -753,8 +753,10 @@ void draw_gs_destroy( struct draw_context *draw )
 {
    int i;
    if (draw->gs.tgsi.machine) {
-      for (i = 0; i < TGSI_MAX_VERTEX_STREAMS; i++)
+      for (i = 0; i < TGSI_MAX_VERTEX_STREAMS; i++) {
          align_free(draw->gs.tgsi.machine->Primitives[i]);
+         align_free(draw->gs.tgsi.machine->PrimitiveOffsets[i]);
+      }
       tgsi_exec_machine_destroy(draw->gs.tgsi.machine);
    }
 }