In buffer.h/cpp there is a output_stdout_buffer_c and input_stdin_buffer_c classes both are derived from handle_buffer_c class and both are setting it's handle to GetStdHandle(...) value.
handle_buffer_c performs CloseHandle in destructor. However multiple invocations of GetStdHandle(...) will return the same value for each std handle type. And it is correct. Which results in double freeing of a resource. Application must close only handles it's created and std handles are not the ones. They must not be closed at all. For details see http://blogs.msdn.com/b/oldnewthing/archive/2013/03/07/10399690.aspx
In buffer.h/cpp there is a
output_stdout_buffer_c
andinput_stdin_buffer_c
classes both are derived fromhandle_buffer_c
class and both are setting it's handle toGetStdHandle(...)
value.handle_buffer_c
performs CloseHandle in destructor. However multiple invocations ofGetStdHandle(...)
will return the same value for each std handle type. And it is correct. Which results in double freeing of a resource. Application must close only handles it's created and std handles are not the ones. They must not be closed at all. For details see http://blogs.msdn.com/b/oldnewthing/archive/2013/03/07/10399690.aspx