[Libreoffice-commits] core.git: sc/source
Julien Nabet
serval2412 at yahoo.fr
Thu Aug 8 13:06:21 PDT 2013
sc/source/core/opencl/openclwrapper.cxx | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
New commits:
commit 5fbc94bc00d04c3af9e519699f91c0fff32df0c3
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Thu Aug 8 08:19:01 2013 +0200
Fix some memory leaks
Change-Id: If8c1b341b8493b8902f060d8d13bbb7d08991cd9
Reviewed-on: https://gerrit.libreoffice.org/5309
Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index bc97217..0557717 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -307,6 +307,12 @@ int OpenclDevice::GeneratBinFromKernelSource( cl_program program, const char * c
binaries[i] = (char*) malloc( sizeof(char) * binarySizes[i] );
if ( binaries[i] == NULL )
{
+ for ( unsigned int j = 0; j < i ; j++)
+ {
+ if (binaries[j])
+ free(binaries[j]);
+ }
+ free(binaries);
return 0;
}
}
@@ -513,12 +519,14 @@ int OpenclDevice::CompileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
b_error |= fseek( fd, 0, SEEK_SET ) < 0;
if ( b_error )
{
+ free(mpArryDevsID);
return 0;
}
binary = (char*) malloc( length + 2 );
if ( !binary )
{
+ free(mpArryDevsID);
return 0;
}
@@ -531,7 +539,12 @@ int OpenclDevice::CompileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
// grab the handles to all of the devices in the context.
clStatus = clGetContextInfo( gpuInfo->mpContext, CL_CONTEXT_DEVICES,
sizeof( cl_device_id ) * numDevices, mpArryDevsID, NULL );
- CHECK_OPENCL( clStatus, "clGetContextInfo" );
+ if (clStatus != CL_SUCCESS)
+ {
+ fprintf (stderr, "OpenCL error code is %d at " SAL_DETAIL_WHERE " when clGetContextInfo .\n", clStatus);
+ free(binary);
+ return 0;
+ }
fprintf(stderr, "Create kernel from binary\n");
gpuInfo->mpArryPrograms[idx] = clCreateProgramWithBinary( gpuInfo->mpContext,numDevices,
More information about the Libreoffice-commits
mailing list