summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_llvm.c
diff options
context:
space:
mode:
authorJan Vesely <[email protected]>2016-01-21 11:17:29 -0500
committerMarek Olšák <[email protected]>2016-01-26 19:04:38 +0100
commitefc4142acd0e5e43b9896440c1c8191d41ff273a (patch)
tree269fb45c91808daa131ba1c86bc2acb9dfd90e15 /src/gallium/drivers/r600/r600_llvm.c
parente1dcd333e4e0757f3fd2b010bc14b36340b70c39 (diff)
r600,compute: Plug few memory leaks
v2: drop inline keyword drop radeon_llvm_dispose_kernel_module wrapper v3: move definitions to .c file use in radeonsi Signed-off-by: Jan Vesely <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_llvm.c')
-rw-r--r--src/gallium/drivers/r600/r600_llvm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
index 8b91372f3ae..232db135be9 100644
--- a/src/gallium/drivers/r600/r600_llvm.c
+++ b/src/gallium/drivers/r600/r600_llvm.c
@@ -910,6 +910,11 @@ unsigned r600_create_shader(struct r600_bytecode *bc,
return 0;
}
+void r600_destroy_shader(struct r600_bytecode *bc)
+{
+ FREE(bc->bytecode);
+}
+
unsigned r600_llvm_compile(
LLVMModuleRef mod,
enum radeon_family family,
@@ -922,17 +927,14 @@ unsigned r600_llvm_compile(
struct radeon_shader_binary binary;
const char * gpu_family = r600_get_llvm_processor_name(family);
- memset(&binary, 0, sizeof(struct radeon_shader_binary));
+ radeon_shader_binary_init(&binary);
if (dump)
LLVMDumpModule(mod);
r = radeon_llvm_compile(mod, &binary, gpu_family, NULL, debug);
r = r600_create_shader(bc, &binary, use_kill);
- FREE(binary.code);
- FREE(binary.config);
- FREE(binary.rodata);
- FREE(binary.global_symbol_offsets);
+ radeon_shader_binary_clean(&binary);
return r;
}