The structure was only freed in case the XTest method was chosen.
But it should always be freed of course (as long as it isn't NULL).
Use a QScopedPointer instead to free it automatically when it goes out of scope and to be more consistent with the rest of the code.