fix dangling pointer
The lifetime of the temporary QByteArray did not extend to the time
when the pointer to its contents was accessed.
Resolved by promoting the QByteArray to automatic storage duration.