[Beignet] [PATCH] Backend: Fix memleak in serialize_program

Xiuli Pan xiuli.pan at intel.com
Thu May 5 06:42:52 UTC 2016


From: Frank Dittrich <frank.dittrich at mailbox.org>

Patch form: https://bugs.freedesktop.org/show_bug.cgi?id=93625

Signed-off-by: Frank Dittrich <frank.dittrich at mailbox.org>
---
 backend/src/gbe_bin_generater.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/backend/src/gbe_bin_generater.cpp b/backend/src/gbe_bin_generater.cpp
index 8225d4a..7ed353a 100644
--- a/backend/src/gbe_bin_generater.cpp
+++ b/backend/src/gbe_bin_generater.cpp
@@ -226,6 +226,7 @@ void program_build_instance::serialize_program(void) throw(int)
         size_t bin_length = gbe_program_serialize_to_binary((gbe_program)gbe_prog, &llvm_binary, 1);
         oss.write(llvm_binary, bin_length);
         sz += bin_length;
+        free(llvm_binary);
       }
 
       for (size_t i = 0; i < sz; i++) {
@@ -258,6 +259,7 @@ void program_build_instance::serialize_program(void) throw(int)
         size_t bin_length = gbe_program_serialize_to_binary((gbe_program)gbe_prog, &llvm_binary, 1);
         ofs.write(llvm_binary, bin_length);
         sz+=bin_length;
+        free(llvm_binary);
       }
     }
 
-- 
2.5.0



More information about the Beignet mailing list