From b0a1eba149df7bc72d038cbe2bc2642e5e7495de Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Sun, 22 Jan 2006 13:06:23 +0000 Subject: [PATCH] don't free the string allocated by RtlDosPathNameToNtPathName_U using RtlFreeUnicodeString because the string isn't allocated with the USTR tag svn path=/trunk/; revision=20974 --- reactos/lib/advapi32/reg/reg.c | 24 ++++++++++++++++++------ reactos/lib/advapi32/sec/misc.c | 14 ++++++++++---- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/reactos/lib/advapi32/reg/reg.c b/reactos/lib/advapi32/reg/reg.c index 925137850b4..741660ce289 100644 --- a/reactos/lib/advapi32/reg/reg.c +++ b/reactos/lib/advapi32/reg/reg.c @@ -2662,7 +2662,9 @@ RegLoadKeyW (HKEY hKey, Status = NtLoadKey (&KeyObjectAttributes, &FileObjectAttributes); - RtlFreeUnicodeString (&FileName); + RtlFreeHeap (RtlGetProcessHeap (), + 0, + FileName.Buffer); if (!NT_SUCCESS(Status)) { @@ -3948,7 +3950,9 @@ RegReplaceKeyW (HKEY hKey, NULL, NULL)) { - RtlFreeUnicodeString (&NewFileName); + RtlFreeHeap (RtlGetProcessHeap (), + 0, + NewFileName.Buffer); if (CloseRealKey) { NtClose (RealKeyHandle); @@ -3967,8 +3971,12 @@ RegReplaceKeyW (HKEY hKey, RealKeyHandle, &OldObjectAttributes); - RtlFreeUnicodeString (&OldFileName); - RtlFreeUnicodeString (&NewFileName); + RtlFreeHeap (RtlGetProcessHeap (), + 0, + OldFileName.Buffer); + RtlFreeHeap (RtlGetProcessHeap (), + 0, + NewFileName.Buffer); if (CloseRealKey) { @@ -4063,7 +4071,9 @@ RegRestoreKeyW (HKEY hKey, &IoStatusBlock, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT); - RtlFreeUnicodeString (&FileName); + RtlFreeHeap (RtlGetProcessHeap(), + 0, + FileName.Buffer); if (!NT_SUCCESS(Status)) { goto Cleanup; @@ -4165,7 +4175,9 @@ RegSaveKeyW (HKEY hKey, FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0); - RtlFreeUnicodeString (&FileName); + RtlFreeHeap (RtlGetProcessHeap (), + 0, + FileName.Buffer); if (!NT_SUCCESS(Status)) { goto Cleanup; diff --git a/reactos/lib/advapi32/sec/misc.c b/reactos/lib/advapi32/sec/misc.c index cbc1050ccad..da3438ec4e2 100644 --- a/reactos/lib/advapi32/sec/misc.c +++ b/reactos/lib/advapi32/sec/misc.c @@ -243,6 +243,11 @@ GetFileSecurityW(LPCWSTR lpFileName, &StatusBlock, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0); + + RtlFreeHeap(RtlGetProcessHeap(), + 0, + FileName.Buffer); + if (!NT_SUCCESS(Status)) { DPRINT("NtOpenFile() failed (Status %lx)\n", Status); @@ -250,8 +255,6 @@ GetFileSecurityW(LPCWSTR lpFileName, return FALSE; } - RtlFreeUnicodeString(&FileName); - Status = NtQuerySecurityObject(FileHandle, RequestedInformation, pSecurityDescriptor, @@ -387,6 +390,11 @@ SetFileSecurityW (LPCWSTR lpFileName, &StatusBlock, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0); + + RtlFreeHeap(RtlGetProcessHeap(), + 0, + FileName.Buffer); + if (!NT_SUCCESS(Status)) { DPRINT("NtOpenFile() failed (Status %lx)\n", Status); @@ -394,8 +402,6 @@ SetFileSecurityW (LPCWSTR lpFileName, return FALSE; } - RtlFreeUnicodeString(&FileName); - Status = NtSetSecurityObject(FileHandle, SecurityInformation, pSecurityDescriptor);