Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
support reusing of CFile::m_pFile #10658
Dont open CFile on Open again if its already opened
Motivation and Context
Calling multiple times open on a filesystem file without calling Close() after each call lead to memory leaks (m_pFile is not closed / freed).
CCurlfile is not able to handle multiple Open calls -> Close it on start of Open
How Has This Been Tested?
CURLCreate -> CURLOpen -> CURLOpen -> CURLClose
Types of change
referenced this pull request
Oct 8, 2016
Only CCurlFile implements ReOpen(). CCurlFile Close() lets m_state intact but resets all the other things wich needs to be resetted to allow a new Open() call. Open() then opens and writes using m_state with the still valid underlying easy_handle. This leads to reuse of the connection (if url matches the previous call)
IMO its the correct behaviour for a method called ReOpen.