don't free the string allocated by RtlDosPathNameToNtPathName_U using RtlFreeUnicodeString because the string isn't allocated with the USTR tag
Modified: trunk/reactos/lib/advapi32/reg/reg.c
Modified: trunk/reactos/lib/advapi32/sec/misc.c

Modified: trunk/reactos/lib/advapi32/reg/reg.c
--- trunk/reactos/lib/advapi32/reg/reg.c	2006-01-22 12:29:40 UTC (rev 20973)
+++ trunk/reactos/lib/advapi32/reg/reg.c	2006-01-22 13:06:23 UTC (rev 20974)
@@ -2662,7 +2662,9 @@
   Status = NtLoadKey (&KeyObjectAttributes,
 		      &FileObjectAttributes);
 
-  RtlFreeUnicodeString (&FileName);
+  RtlFreeHeap (RtlGetProcessHeap (),
+               0,
+               FileName.Buffer);
 
   if (!NT_SUCCESS(Status))
     {
@@ -3948,7 +3950,9 @@
 				     NULL,
 				     NULL))
     {
-      RtlFreeUnicodeString (&NewFileName);
+      RtlFreeHeap (RtlGetProcessHeap (),
+                   0,
+                   NewFileName.Buffer);
       if (CloseRealKey)
 	{
 	  NtClose (RealKeyHandle);
@@ -3967,8 +3971,12 @@
 			 RealKeyHandle,
 			 &OldObjectAttributes);
 
-  RtlFreeUnicodeString (&OldFileName);
-  RtlFreeUnicodeString (&NewFileName);
+  RtlFreeHeap (RtlGetProcessHeap (),
+               0,
+               OldFileName.Buffer);
+  RtlFreeHeap (RtlGetProcessHeap (),
+               0,
+               NewFileName.Buffer);
 
   if (CloseRealKey)
     {
@@ -4063,7 +4071,9 @@
 		       &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 @@
 			 FILE_OPEN_FOR_BACKUP_INTENT | FILE_SYNCHRONOUS_IO_NONALERT,
 			 NULL,
 			 0);
-  RtlFreeUnicodeString (&FileName);
+  RtlFreeHeap (RtlGetProcessHeap (),
+               0,
+               FileName.Buffer);
   if (!NT_SUCCESS(Status))
     {
       goto Cleanup;

Modified: trunk/reactos/lib/advapi32/sec/misc.c
--- trunk/reactos/lib/advapi32/sec/misc.c	2006-01-22 12:29:40 UTC (rev 20973)
+++ trunk/reactos/lib/advapi32/sec/misc.c	2006-01-22 13:06:23 UTC (rev 20974)
@@ -243,6 +243,11 @@
 		      &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 @@
       return FALSE;
     }
 
-  RtlFreeUnicodeString(&FileName);
-
   Status = NtQuerySecurityObject(FileHandle,
 				 RequestedInformation,
 				 pSecurityDescriptor,
@@ -387,6 +390,11 @@
 		      &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 @@
       return FALSE;
     }
 
-  RtlFreeUnicodeString(&FileName);
-
   Status = NtSetSecurityObject(FileHandle,
 			       SecurityInformation,
 			       pSecurityDescriptor);