Free all allocated memory in ObpDeleteObject.
authorHartmut Birr <osexpert@googlemail.com>
Sat, 21 May 2005 12:19:26 +0000 (12:19 +0000)
committerHartmut Birr <osexpert@googlemail.com>
Sat, 21 May 2005 12:19:26 +0000 (12:19 +0000)
svn path=/trunk/; revision=15453

reactos/ntoskrnl/ob/object.c

index 62ab62f..fc27eb3 100644 (file)
@@ -801,20 +801,29 @@ ObpDeleteObject(POBJECT_HEADER Header)
       KEBUGCHECK(0);
     }
 
       KEBUGCHECK(0);
     }
 
+  if (Header->ObjectType != NULL &&
+      Header->ObjectType->TypeInfo.DeleteProcedure != NULL)
+    {
+      Header->ObjectType->TypeInfo.DeleteProcedure(HEADER_TO_BODY(Header));
+    }
+
   if (Header->SecurityDescriptor != NULL)
     {
       ObpRemoveSecurityDescriptor(Header->SecurityDescriptor);
     }
     
   if (Header->SecurityDescriptor != NULL)
     {
       ObpRemoveSecurityDescriptor(Header->SecurityDescriptor);
     }
     
-  if (Header->NameInfo && Header->NameInfo->Name.Buffer)
-  {
-      ExFreePool(Header->NameInfo->Name.Buffer);
-  }
-
-  if (Header->ObjectType != NULL &&
-      Header->ObjectType->TypeInfo.DeleteProcedure != NULL)
+  if (Header->NameInfo)
     {
     {
-      Header->ObjectType->TypeInfo.DeleteProcedure(HEADER_TO_BODY(Header));
+      if(Header->NameInfo->Name.Buffer)
+        {
+          ExFreePool(Header->NameInfo->Name.Buffer);
+        }
+      ExFreePool(Header->NameInfo);
+    }
+  if (Header->ObjectCreateInfo)
+    {
+      ObpReleaseCapturedAttributes(Header->ObjectCreateInfo);
+      ExFreePool(Header->ObjectCreateInfo);
     }
 
   DPRINT("ObPerformRetentionChecks() = Freeing object\n");
     }
 
   DPRINT("ObPerformRetentionChecks() = Freeing object\n");