diff --git a/paw/stos/ob/ob.c b/paw/stos/ob/ob.c index 8187481..607cb32 100644 --- a/paw/stos/ob/ob.c +++ b/paw/stos/ob/ob.c @@ -66,14 +66,20 @@ ObCreateObject(const CHAR *Name, OBJECT_TYPE Type, VOID *Data, ST_OBJECT **Resul return STATUS_NAME_TOO_LONG; } - Object = ExAllocatePoolWithTag( - POOL_NON_PAGED, - sizeof(*Object), - OBJECT_POOL_TAG - ); - + /* + * Try to pull an object from the cache, if there are not + * objects to pull then we'll allocate one. + */ + Object = ObPopFromCache(&gObCache); if (Object == NULL) { - return STATUS_NO_MEMORY; + Object = ExAllocatePoolWithTag( + POOL_NON_PAGED, + sizeof(*Object), + OBJECT_POOL_TAG + ); + + if (Object == NULL) + return STATUS_NO_MEMORY; } RtlMemSet(Object, 0, sizeof(*Object));