Fix CPUCaching allocator guard bug (#46922)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/46922
Earlier bug wrongly captures the previous value to be saved.
Test Plan: cpu_caching_allocator_test
Reviewed By: dreiss
Differential Revision: D24566514
fbshipit-source-id: 734a4c1f810bbec16fe007f31fffa360898955ac