fixed a memory leak in RegDeleteTree() that could be caused when two
threads attempt to delete the same tree simultaneously
Modified: trunk/reactos/lib/advapi32/reg/reg.c
_____
Modified: trunk/reactos/lib/advapi32/reg/reg.c
--- trunk/reactos/lib/advapi32/reg/reg.c 2005-10-03 21:40:58 UTC
(rev 18253)
+++ trunk/reactos/lib/advapi32/reg/reg.c 2005-10-03 22:46:49 UTC
(rev 18254)
@@ -1466,7 +1466,15 @@
}
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 @@
NULL);
Status = NtOpenKey(&SubKeyHandle,
- DELETE | KEY_ENUMERATE_SUB_KEYS |
KEY_QUERY_VALUE,
+ DELETE | KEY_ENUMERATE_SUB_KEYS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
Show replies by date