fixed double-free problem if OpenCL/ folder is missing (and e.g. shared folder == session folder)
This commit is contained in:
+23
-1
@@ -435,10 +435,32 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const char *ins
|
||||
hcfree (cwd);
|
||||
|
||||
hcfree (shared_dir);
|
||||
|
||||
// Attention: since hcfree () doesn't set the pointer to NULL, we need to do it externally such that
|
||||
// we prevent double-freeing the same memory address (this happens if e.g. profile_dir == session_dir)
|
||||
|
||||
if (profile_dir == shared_dir) profile_dir = NULL;
|
||||
if (session_dir == shared_dir) session_dir = NULL;
|
||||
|
||||
shared_dir = NULL;
|
||||
|
||||
|
||||
hcfree (profile_dir);
|
||||
hcfree (cpath_real);
|
||||
|
||||
if (session_dir == profile_dir) session_dir = NULL;
|
||||
|
||||
profile_dir = NULL;
|
||||
|
||||
|
||||
hcfree (session_dir);
|
||||
|
||||
session_dir = NULL;
|
||||
|
||||
|
||||
hcfree (cpath_real);
|
||||
|
||||
cpath_real = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user