1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 18:08:20 +00:00

OpenCL platforms/devices: Fixed several memory leaks when a platform/device could not be used/initialized

This commit is contained in:
philsmd 2017-02-14 11:52:53 +01:00
parent 15f9a3ad83
commit 6ef802a148
No known key found for this signature in database
GPG Key ID: 4F25D016D9D6A8AF
2 changed files with 27 additions and 2 deletions

View File

@ -62,6 +62,7 @@
- Files: Do several file and folder checks on startup rather than when they are actually used to avoid related error after eventual intense operations - Files: Do several file and folder checks on startup rather than when they are actually used to avoid related error after eventual intense operations
- Helper: Added functions to check existence, type, read- and write-permissions and rewrite sources to use them instead of stat() - Helper: Added functions to check existence, type, read- and write-permissions and rewrite sources to use them instead of stat()
- Hardware Monitor: Fixed several memory leaks when no hardware monitor sensor is found - Hardware Monitor: Fixed several memory leaks when no hardware monitor sensor is found
- OpenCL Device Management: Fixed several memory leaks when initialization of a device/platform failed
- OpenCL Header: Updated CL_* errorcode to OpenCL 1.2 standard - OpenCL Header: Updated CL_* errorcode to OpenCL 1.2 standard
- OpenCL Runtime: Updated AMDGPU-Pro driver version check, do warn if version 16.60 is detected which is known to be broken - OpenCL Runtime: Updated AMDGPU-Pro driver version check, do warn if version 16.60 is detected which is known to be broken
- OpenCL Kernel: Renumbered hash-mode 7600 to 4521 - OpenCL Kernel: Renumbered hash-mode 7600 to 4521

View File

@ -2209,7 +2209,22 @@ int opencl_ctx_init (hashcat_ctx_t *hashcat_ctx)
int CL_rc = hc_clGetPlatformIDs (hashcat_ctx, CL_PLATFORMS_MAX, platforms, &platforms_cnt); int CL_rc = hc_clGetPlatformIDs (hashcat_ctx, CL_PLATFORMS_MAX, platforms, &platforms_cnt);
if (CL_rc == -1) return -1; #define FREE_OPENCL_CTX_ON_ERROR \
{ \
hcfree (platforms_vendor); \
hcfree (platforms_name); \
hcfree (platforms_version); \
hcfree (platforms_skipped); \
hcfree (platforms); \
hcfree (platform_devices); \
}
if (CL_rc == -1)
{
FREE_OPENCL_CTX_ON_ERROR;
return -1;
}
if (platforms_cnt == 0) if (platforms_cnt == 0)
{ {
@ -2233,6 +2248,8 @@ int opencl_ctx_init (hashcat_ctx_t *hashcat_ctx)
event_log_error (hashcat_ctx, "* NVidia users require \"NVIDIA Driver\" (367.x or later)"); event_log_error (hashcat_ctx, "* NVidia users require \"NVIDIA Driver\" (367.x or later)");
FREE_OPENCL_CTX_ON_ERROR;
return -1; return -1;
} }
@ -2244,6 +2261,8 @@ int opencl_ctx_init (hashcat_ctx_t *hashcat_ctx)
{ {
event_log_error (hashcat_ctx, "The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%u)", platforms_cnt); event_log_error (hashcat_ctx, "The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%u)", platforms_cnt);
FREE_OPENCL_CTX_ON_ERROR;
return -1; return -1;
} }
} }
@ -2275,7 +2294,12 @@ int opencl_ctx_init (hashcat_ctx_t *hashcat_ctx)
CL_rc = hc_clGetDeviceInfo (hashcat_ctx, device, CL_DEVICE_TYPE, sizeof (device_type), &device_type, NULL); CL_rc = hc_clGetDeviceInfo (hashcat_ctx, device, CL_DEVICE_TYPE, sizeof (device_type), &device_type, NULL);
if (CL_rc == -1) return -1; if (CL_rc == -1)
{
FREE_OPENCL_CTX_ON_ERROR;
return -1;
}
device_types_all |= device_type; device_types_all |= device_type;
} }