Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Replace raw new/delete in Util with stack object #11387
Replace a single heap object allocated using new/delete with a stack-allocated object.
Motivation and Context
Raw new/delete may lead to inadvertent memory leaks if we return early / throw an exception. I considered using a smart pointer but the object we're constructing seemed relatively small so it seemed fine to just construct it on the stack.
How Has This Been Tested?
This concerns loading of SMI subtitles. I compiled & ran my changes on x86-64 Ubuntu and loaded a sample SMI subtitle file. KODI ran fine & displayed the expected subtitles.
The changes should be localised in this part of the code.
I considered adding unit tests for this change but this function has external dependencies on the filesystem which seem non-trivial to isolate.
Types of change