I still haven’t figured out in the non-error path who is responsible for deleting this buffer. One immediate problem is we allocate a buffer on the heap in many places like the following in fileio_winrt.cpp at line 328:
fInfo->m_buffer = new char[fInfo->m_bufsize*char_size];
Then in numerous places we mismatch a delete, for example look at the code just 4 lines above:
if ( fInfo->m_buffer != nullptr )
delete fInfo->m_buffer;
This is bad and I see this going on in lots of places.
Comments: This is in Windows specific code and on Windows with raw char data structure this will still be freed correctly. So there isn't a leak but this is still bad code.
fInfo->m_buffer = new char[fInfo->m_bufsize*char_size];
Then in numerous places we mismatch a delete, for example look at the code just 4 lines above:
if ( fInfo->m_buffer != nullptr )
delete fInfo->m_buffer;
This is bad and I see this going on in lots of places.
Comments: This is in Windows specific code and on Windows with raw char data structure this will still be freed correctly. So there isn't a leak but this is still bad code.