> +void ntdll_object_release(struct ntdll_object *obj) > +{ > + int refcount = interlocked_xchg_add(&obj->refcount, -1); > + assert(refcount > 0); > + > + if (!refcount) > + { You have an assert followed by a check for a condition that would've failed the assert. I'm guessing you meant to check for refcount == 1?