If for whatever reason iterator_resource->set_iterator did not return Status::OK(), we would leak a reference on the iterator_resource. With this change, we won't leak the resource.
PiperOrigin-RevId:
194662412
IteratorResource* iterator_resource;
OP_REQUIRES_OK(
ctx, LookupResource(ctx, HandleFromInput(ctx, 1), &iterator_resource));
+ core::ScopedUnref unref(iterator_resource);
OP_REQUIRES_OK(ctx, iterator_resource->set_iterator(
dataset->MakeIterator("Iterator")));
- iterator_resource->Unref();
}
};