diff options
author | Guo Yejun <yejun.guo@intel.com> | 2014-07-24 07:51:18 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2014-07-25 14:32:41 +0800 |
commit | 3155d4c2d137f8920db71ccf30a66a7e831b8cd2 (patch) | |
tree | e431a4058b090cda8e68e7cbe0ce6a3d114e1d94 | |
parent | ca9c57cae241582367735ce84176b2e9c7991258 (diff) |
fix three memory leaks
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
Reviewed-by: "Song, Ruiling" <ruiling.song@intel.com>
-rw-r--r-- | backend/src/llvm/llvm_printf_parser.cpp | 3 | ||||
-rw-r--r-- | backend/src/llvm/llvm_to_gen.cpp | 1 | ||||
-rw-r--r-- | src/cl_command_queue.c | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/backend/src/llvm/llvm_printf_parser.cpp b/backend/src/llvm/llvm_printf_parser.cpp index 74b57ab0..384d36f8 100644 --- a/backend/src/llvm/llvm_printf_parser.cpp +++ b/backend/src/llvm/llvm_printf_parser.cpp @@ -543,12 +543,13 @@ error: module = F.getParent(); intTy = IntegerType::get(module->getContext(), 32); - builder = new IRBuilder<>(module->getContext()); // As we inline all function calls, so skip non-kernel functions bool bKernel = isKernelFunction(F); if(!bKernel) return false; + builder = new IRBuilder<>(module->getContext()); + /* Iter the function and find printf. */ for (llvm::Function::iterator B = F.begin(), BE = F.end(); B != BE; B++) { for (BasicBlock::iterator instI = B->begin(), diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp index 328dbc19..3527491e 100644 --- a/backend/src/llvm/llvm_to_gen.cpp +++ b/backend/src/llvm/llvm_to_gen.cpp @@ -256,6 +256,7 @@ namespace gbe iter++; } + delete libraryInfo; return true; } } /* namespace gbe */ diff --git a/src/cl_command_queue.c b/src/cl_command_queue.c index d45e92f1..842c8649 100644 --- a/src/cl_command_queue.c +++ b/src/cl_command_queue.c @@ -446,7 +446,9 @@ cl_command_queue_flush_gpgpu(cl_command_queue queue, cl_gpgpu gpgpu) cl_gpgpu_unmap_printf_buffer(gpgpu, 0); if (interp_get_printf_sizeof_size(printf_info)) cl_gpgpu_unmap_printf_buffer(gpgpu, 1); + } + if (printf_info) { interp_release_printf_info(printf_info); global_wk_sz[0] = global_wk_sz[1] = global_wk_sz[2] = 0; cl_gpgpu_set_printf_info(gpgpu, NULL, global_wk_sz); |