Commit ffa57428 authored by Derek Murray's avatar Derek Murray Committed by TensorFlower Gardener
Browse files

Fix potential use-after-free in the training ops.

The recent fix to a resource leak introduced a potential use-after-free, because it released a reference on a Var resource before returning a mutex* borrowed from that resource. The mutex* could therefore become garbage if the refcount concurrently dropped to zero (for example, if a concurrent `Session::Reset()` were issued).

This change modifies the mutex accessing utilities to prolong the lifetime of the corresponding Var* beyond the lifetime of the returned mutex*.

PiperOrigin-RevId: 214678937
parent 844074c2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment