Why don't you create newData in stack? I.e.:
```cpp
messageData data(input_file);
```