[Beignet] [PATCH] fix three memory leaks
Song, Ruiling
ruiling.song at intel.com
Thu Jul 24 01:07:11 PDT 2014
Great Job! The patch LGTM.
-----Original Message-----
From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Guo Yejun
Sent: Thursday, July 24, 2014 7:51 AM
To: beignet at lists.freedesktop.org
Cc: Guo, Yejun
Subject: [Beignet] [PATCH] fix three memory leaks
Signed-off-by: Guo Yejun <yejun.guo at intel.com>
---
backend/src/llvm/llvm_printf_parser.cpp | 3 ++-
backend/src/llvm/llvm_to_gen.cpp | 1 +
src/cl_command_queue.c | 2 ++
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/backend/src/llvm/llvm_printf_parser.cpp b/backend/src/llvm/llvm_printf_parser.cpp
index 74b57ab..384d36f 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 328dbc1..3527491 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 d45e92f..842c864 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);
--
1.8.3.2
_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list