mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-23 15:18:16 +00:00
OpenCL platforms/devices: Fixed several memory leaks when a platform/device could not be used/initialized
This commit is contained in:
parent
15f9a3ad83
commit
6ef802a148
@ -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
|
||||
- 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
|
||||
- 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 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
|
||||
|
28
src/opencl.c
28
src/opencl.c
@ -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);
|
||||
|
||||
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)
|
||||
{
|
||||
@ -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)");
|
||||
|
||||
FREE_OPENCL_CTX_ON_ERROR;
|
||||
|
||||
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);
|
||||
|
||||
FREE_OPENCL_CTX_ON_ERROR;
|
||||
|
||||
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);
|
||||
|
||||
if (CL_rc == -1) return -1;
|
||||
if (CL_rc == -1)
|
||||
{
|
||||
FREE_OPENCL_CTX_ON_ERROR;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
device_types_all |= device_type;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user