fix issue 1043

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@1116 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
zdenop 2014-06-08 21:26:02 +00:00
parent 780183226c
commit 41bd040ef5

View File

@ -711,6 +711,14 @@ int OpenclDevice::GeneratBinFromKernelSource( cl_program program, const char * c
binaries[i] = (char*) malloc( sizeof(char) * binarySizes[i] );
if ( binaries[i] == NULL )
{
// cleanup all memory allocated so far
for(int cleanupIndex = 0; cleanupIndex < i; ++cleanupIndex)
{
free(binaries[cleanupIndex]);
}
// cleanup binary array
free(binaries);
return 0;
}
}