fixed a memory leak in RegDeleteTree() that could be caused when two threads attempt...
authorThomas Bluemel <thomas@reactsoft.com>
Mon, 3 Oct 2005 22:46:49 +0000 (22:46 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Mon, 3 Oct 2005 22:46:49 +0000 (22:46 +0000)
svn path=/trunk/; revision=18254

reactos/lib/advapi32/reg/reg.c

index 0e18593..bbba477 100644 (file)
@@ -1466,7 +1466,15 @@ ReadFirstSubKey:
                 }
                 else if (Status2 == STATUS_NO_MORE_ENTRIES)
                 {
-                    ASSERT(newDelKeys == NULL);
+                    /* in some race conditions where another thread would delete
+                       the same tree at the same time, newDelKeys could actually
+                       be != NULL! */
+                    if (newDelKeys != NULL)
+                    {
+                        RtlFreeHeap(ProcessHeap,
+                                    0,
+                                    newDelKeys);
+                    }
                     break;
                 }
 
@@ -1555,7 +1563,7 @@ RegDeleteTreeW(IN HKEY hKey,
                                    NULL);
 
         Status = NtOpenKey(&SubKeyHandle,
-                           DELETE | KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE,
+                           DELETE | KEY_ENUMERATE_SUB_KEYS,
                            &ObjectAttributes);
         if (!NT_SUCCESS(Status))
         {