[ros-diffs] [weiden] 20974: don't free the string allocated by RtlDosPathNameToNtPathName_U using RtlFreeUnicodeString because the string isn't allocated with the USTR tag

weiden at svn.reactos.org weiden at svn.reactos.org
Sun Jan 22 14:06:37 CET 2006


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);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20060122/a195a64c/attachment.html


More information about the Ros-diffs mailing list