Join GitHub today
Various cppcheck perf fixes #6803
Basically I don't like the
To solve the "new in initializer list may lead to resource leak" problem I suggest to change the type of m_subtitles and m_serviceItems to std::auto_ptr.
Then, new in init list is no harmful any more. If first new (m_subtitles) in initlist fails, no memory gets allocated on the heap, thus no resource leak. If first new succeeds and second new (m_serviceItems) fails, dtor of (the already fully constructed) std::auto_ptr m_subtitles will be called, which frees the heap memory allocated with the first new.