1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-23 00:28:11 +00:00

Fix free unallocated memory in case OpenCL initialization failed

This commit is contained in:
Jens Steube 2019-05-14 10:25:49 +02:00
parent bca03bb7ed
commit 523e0f7151

View File

@ -5255,20 +5255,23 @@ void backend_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
if (backend_ctx->enabled == false) return;
hcfree (backend_ctx->devices_param);
if (backend_ctx->ocl)
{
hcfree (backend_ctx->opencl_platforms);
hcfree (backend_ctx->opencl_platforms_devices);
hcfree (backend_ctx->opencl_platforms_devices_cnt);
hcfree (backend_ctx->opencl_platforms_name);
hcfree (backend_ctx->opencl_platforms_vendor);
hcfree (backend_ctx->opencl_platforms_vendor_id);
hcfree (backend_ctx->opencl_platforms_version);
}
nvrtc_close (hashcat_ctx);
cuda_close (hashcat_ctx);
ocl_close (hashcat_ctx);
hcfree (backend_ctx->devices_param);
hcfree (backend_ctx->opencl_platforms);
hcfree (backend_ctx->opencl_platforms_devices);
hcfree (backend_ctx->opencl_platforms_devices_cnt);
hcfree (backend_ctx->opencl_platforms_name);
hcfree (backend_ctx->opencl_platforms_vendor);
hcfree (backend_ctx->opencl_platforms_vendor_id);
hcfree (backend_ctx->opencl_platforms_version);
memset (backend_ctx, 0, sizeof (backend_ctx_t));
}