[Beignet] [PATCH 5/5] Runtime: Fix memleak in build program for bin

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


From: Pan Xiuli <xiuli.pan at intel.com>

Signed-off-by: Pan Xiuli <xiuli.pan at intel.com>
---
 src/cl_program.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cl_program.c b/src/cl_program.c
index b4656ce..85dc184 100644
--- a/src/cl_program.c
+++ b/src/cl_program.c
@@ -293,6 +293,7 @@ cl_program_create_from_binary(cl_context             ctx,
     /* Create all the kernels */
     TRY (cl_program_load_gen_program, program);
     program->binary_type = CL_PROGRAM_BINARY_TYPE_EXECUTABLE;
+    program->source_type = FROM_BINARY;
   }
   else {
     err= CL_INVALID_BINARY;
@@ -601,7 +602,7 @@ cl_program_build(cl_program p, const char *options)
     }
     /* Create all the kernels */
     TRY (cl_program_load_gen_program, p);
-  } else if (p->source_type == FROM_BINARY) {
+  } else if (p->source_type == FROM_BINARY && p->binary_type != CL_PROGRAM_BINARY_TYPE_EXECUTABLE) {
     p->opaque = interp_program_new_from_binary(p->ctx->device->device_id, p->binary, p->binary_sz);
     if (UNLIKELY(p->opaque == NULL)) {
       err = CL_BUILD_PROGRAM_FAILURE;
-- 
2.5.0



More information about the Beignet mailing list