[quant] Fix use after free (#59267)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/59267
fixes: https://github.com/pytorch/pytorch/issues/58868
Test Plan: Imported from OSS
Reviewed By: jbschlosser, supriyar
Differential Revision: D28811529
fbshipit-source-id: f27018ae0a02d1dd229d1ff7638f130c38a00986