aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGil Pitney <gil.pitney@linaro.org>2015-06-17 00:49:55 +0000
committerGil Pitney <gil.pitney@linaro.org>2015-06-17 00:49:55 +0000
commit635437f5fdcbd8274f1505ae0e2750ceca3060c5 (patch)
tree86e4f7b5f909b4765485aada1111d7e7a283dc5d
parente7161be3b642ca019ddb2c7d3ffbcb5693c5d1d7 (diff)
downloadshamrock-635437f5fdcbd8274f1505ae0e2750ceca3060c5.tar.gz
clCreateProgramWithBinary(): fix memory leak.
Memory for a temporary array of context devices was not getting freed. Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
-rw-r--r--src/api/api_program.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/api/api_program.cpp b/src/api/api_program.cpp
index 5dd6350..4afd603 100644
--- a/src/api/api_program.cpp
+++ b/src/api/api_program.cpp
@@ -119,9 +119,10 @@ clCreateProgramWithBinary(cl_context context,
context_num_devices * sizeof(cl_device_id),
context_devices, 0);
- if (*errcode_ret != CL_SUCCESS)
+ if (*errcode_ret != CL_SUCCESS) {
+ std::free(context_devices);
return 0;
-
+ }
for (cl_uint i=0; i<num_devices; ++i)
{
bool found = false;
@@ -132,6 +133,7 @@ clCreateProgramWithBinary(cl_context context,
binary_status[i] = CL_INVALID_VALUE;
*errcode_ret = CL_INVALID_VALUE;
+ std::free(context_devices);
return 0;
}
@@ -147,6 +149,7 @@ clCreateProgramWithBinary(cl_context context,
if (!found)
{
*errcode_ret = CL_INVALID_DEVICE;
+ std::free(context_devices);
return 0;
}
}
@@ -163,9 +166,11 @@ clCreateProgramWithBinary(cl_context context,
if (*errcode_ret != CL_SUCCESS)
{
delete program;
+ std::free(context_devices);
return 0;
}
+ std::free(context_devices);
return (cl_program)program;
}