[REGEDIT] Fix HeapFree() on the wrong variable (#2736)

- When exporting registry keys (to .reg files) some variables from the heap are not free'd while the debug log indicates "HEAP: Trying to free an invalid address".
- This is due to the export_registry_key() function that calls
HeapFree() for reg_key_name. But this variable is an argument provided by the caller, which is always a statically defined array of WCHAR.
- Meanwhile reg_key_name_buf is never free'd and cause a memory leak each time the function gets called.
This commit is contained in:
Kyle Katarn 2020-05-05 10:44:45 +02:00 committed by GitHub
parent 9634a31589
commit 0461de33c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1392,7 +1392,7 @@ BOOL export_registry_key(WCHAR *file_name, WCHAR *reg_key_name, DWORD format)
if (file) {
fclose(file);
}
HeapFree(GetProcessHeap(), 0, reg_key_name);
HeapFree(GetProcessHeap(), 0, reg_key_name_buf);
HeapFree(GetProcessHeap(), 0, val_name_buf);
HeapFree(GetProcessHeap(), 0, val_buf);
HeapFree(GetProcessHeap(), 0, line_buf);