diff --git a/opencl/opencl_device_selection.h b/opencl/opencl_device_selection.h index 238250cb70..5161125683 100644 --- a/opencl/opencl_device_selection.h +++ b/opencl/opencl_device_selection.h @@ -72,10 +72,8 @@ static ds_status releaseDSProfile(ds_profile* profile, ds_score_release sr) { if (profile->devices!=NULL && sr!=NULL) { unsigned int i; for (i = 0; i < profile->numDevices; i++) { - if (profile->devices[i].oclDeviceName) - free(profile->devices[i].oclDeviceName); - if (profile->devices[i].oclDriverVersion) - free(profile->devices[i].oclDriverVersion); + free(profile->devices[i].oclDeviceName); + free(profile->devices[i].oclDriverVersion); status = sr(profile->devices[i].score); if (status != DS_SUCCESS) break; @@ -171,15 +169,14 @@ static ds_status initDSProfile(ds_profile** p, const char* version) { profile->version = version; cleanup: - if (platforms) free(platforms); - if (devices) free(devices); + free(platforms); + free(devices); if (status == DS_SUCCESS) { *p = profile; } else { if (profile) { - if (profile->devices) - free(profile->devices); + free(profile->devices); free(profile); } } @@ -585,7 +582,7 @@ static ds_status readProfileFromFile(ds_profile* profile, } } cleanup: - if (contentStart!=NULL) free(contentStart); + free(contentStart); return status; } diff --git a/opencl/openclwrapper.cpp b/opencl/openclwrapper.cpp index 2a0420fb7c..7ca00f35a6 100644 --- a/opencl/openclwrapper.cpp +++ b/opencl/openclwrapper.cpp @@ -538,30 +538,19 @@ int OpenclDevice::GeneratBinFromKernelSource( cl_program program, const char * c // Release all resouces and memory for ( i = 0; i < numDevices; i++ ) { - if ( binaries[i] != NULL ) - { - free( binaries[i] ); - binaries[i] = NULL; - } + free(binaries[i]); + binaries[i] = NULL; } - if ( binaries != NULL ) - { - free( binaries ); - binaries = NULL; - } + free( binaries ); + binaries = NULL; - if ( binarySizes != NULL ) - { - free( binarySizes ); - binarySizes = NULL; - } + free(binarySizes); + binarySizes = NULL; - if ( mpArryDevsID != NULL ) - { - free( mpArryDevsID ); - mpArryDevsID = NULL; - } + free(mpArryDevsID); + mpArryDevsID = NULL; + return 1; } diff --git a/training/commontraining.cpp b/training/commontraining.cpp index f77a553de4..f415198bcf 100644 --- a/training/commontraining.cpp +++ b/training/commontraining.cpp @@ -524,7 +524,7 @@ CLUSTERER *SetUpForClustering(const FEATURE_DEFS_STRUCT &FeatureDefs, } CharID++; } - if ( Sample != NULL ) free( Sample ); + free( Sample ); return( Clusterer ); } /* SetUpForClustering */