fixed a memory leak in RegDeleteTree() that could be caused when two threads attempt to delete the same tree simultaneously

svn path=/trunk/; revision=18254
This commit is contained in:
Thomas Bluemel 2005-10-03 22:46:49 +00:00
parent 64e0a3529d
commit f710105b8b

View 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))
{