Fixes a bug introduced by PR #4729 which swapped a heap buffer for a stack buffer but placed the buffer in a too-deep scope.
Manually tested via: $ qemu-aarch64 -L /usr/aarch64-linux-gnu bin64/drrun -xarch_root /usr/aarch64-linux-gnu -- suite/tests/bin/simple_app $ qemu-arm -L /usr/arm-linux-gnueabihf bin32/drrun -xarch_root /usr/arm-linux-gnueabihf -- suite/tests/bin/simple_app
Forthcoming test suite support for running under qemu will add CI tests that will avoid such regressions in the future.
Issue: #4719