Fix potential (but unreachable) use-after-free in error case in MultiDeviceIteratorOp.
When an anonymous MultiDeviceIterator is created, the sole reference on it transfers to the ResourceMgr during the call to ResourceMgr::Create(). It is not safe to call VerifyResource() on the resource after that point (since the ResourceMgr now owns the resource, and might delete it), and it is redundant to do so (since we just created the resource with the op's shapes and types). Although the status would never be non-OK, if the resource->Unref() in the error branch were called, the ResourceMgr would be left with a dangling pointer. Since the status is never non-OK, we can remove the check altogether and simplify the logic. PiperOrigin-RevId: 234819808
Loading
Please sign in to comment