This reverts commit ac6cb413. This code has a stack-use-after-scope error that can be seen with asan.