[tf.data] Use core::ScopedUnref to avoid resource leakage.
authorBrennan Saeta <saeta@google.com>
Sat, 28 Apr 2018 17:51:32 +0000 (10:51 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Sat, 28 Apr 2018 17:54:57 +0000 (10:54 -0700)
commitfb1069781ffcbac222392a68c01a45fae264888e
tree45c55f7d832be4f6b278787424c423c242f15d4f
parentc01858350a1fc0f0fbf9a38fcd5c71e565343316
[tf.data] Use core::ScopedUnref to avoid resource leakage.

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
tensorflow/core/kernels/data/iterator_ops.cc