Closed
Description
Pull #8296 adds a type (CString) to wrap char pointers returned from C code into Rust strings. The Drop impl on CString function always calls libc::free(). This is not generally correct on Windows.
On Windows, each function or API specifies which free()-like function to use. Not using the correct function will cause problems.
Raymond Chen (at the Old New Thing blog) has more details on why Windows works this way: http://blogs.msdn.com/b/oldnewthing/archive/2006/09/15/755966.aspx
I don't know Rust well enough to say what the correct fix is. Maybe pass in a function pointer to the constructor that is called at drop? The pointer could replace the "owns_buffer" bool if we use an optional pointer.