Module: Mesa Branch: master Commit: e9bf09a98a624e594bdea2503326bb693b8cf9b8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e9bf09a98a624e594bdea2503326bb693b8cf9b8
Author: José Fonseca <[email protected]> Date: Fri Apr 30 19:00:58 2010 +0100 draw: Fix memory leaks in llvm code. --- src/gallium/auxiliary/draw/draw_llvm.c | 2 + .../draw/draw_pt_fetch_shade_pipeline_llvm.c | 24 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 3b2df05..2c23428 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -207,6 +207,8 @@ draw_llvm_create(struct draw_context *draw) void draw_llvm_destroy(struct draw_llvm *llvm) { + LLVMDisposePassManager(llvm->pass); + FREE(llvm); } diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c index d2a492f..35913a5 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c @@ -349,7 +349,31 @@ static void llvm_middle_end_finish( struct draw_pt_middle_end *middle ) static void llvm_middle_end_destroy( struct draw_pt_middle_end *middle ) { struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle; + struct draw_context *draw = fpme->draw; + struct draw_llvm_variant *variant = NULL; + + variant = fpme->variants; + while(variant) { + struct draw_llvm_variant *next = variant->next; + if (variant->function_elts) { + if (variant->function_elts) + LLVMFreeMachineCodeForFunction(draw->engine, + variant->function_elts); + LLVMDeleteFunction(variant->function_elts); + } + + if (variant->function) { + if (variant->function) + LLVMFreeMachineCodeForFunction(draw->engine, + variant->function); + LLVMDeleteFunction(variant->function); + } + + FREE(variant); + + variant = next; + } if (fpme->fetch) draw_pt_fetch_destroy( fpme->fetch ); _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
