Re #7876. Fix potential memory leak.

Don't leak memory if one of the 3 allocations failed.
Re #7876. Fix memory leak.

I'm not sure if this constructor actually can throw, but regardless
there's no need to create it on the heap.
Re #7876. Fix potential memory leaked.

This leaked if m was NULL at line 12178. Use RAII to avoid the problem.
Re #7876. Fix potential memory leaks.
Re #7876. Use vectors instead of arrays to avoid leaks.
Re #7876. Fix memory leaks.

Don't create objects on the heap if you don't need to!
Re #7876. Correct to use array delete.
Re #7876. Move delete until after last use.

m_data is used within saveSettings(), so we'd better not delete it
until after that!
Re #7876. Delete right before new allocation.

The coverity scan complained that the deleted fitter could be used at
line 234 if all the if tests above it were false. Don't know if that
can happen, but let's be safe.
Re #7876. Remove unused method.

I don't think this method is used anywhere, which is a good thing as it
was returning a pointer to a temporary.
Re #7876. Refactor to not return pointers to temporaries.
Re #7876. Make sure variable is initialised.

In 332cf05 I removed the call that also initialised the array. This
remedies that.
Merge branch 'feature/7876_coverity_errors' into develop