[Mono-dev] CreateFile() leaks memory?

Jonathan Pryor jonpryor at vt.edu
Fri Apr 7 07:00:52 EDT 2006

On Fri, 2006-04-07 at 11:35 +0800, hhf at eisoo.com wrote:
> I'm studying Mono. Today I read the code of CreateFile() function, I
> found that if the function forget to call g_free() to release the memory
> after conversion from utf16 to utf8. Right?

Where are you seeing this?  In mono/io-layer/io.c:CreateFile, I see
calls of ``g_free (filename);'' in several places -- when fd==-1, when
fd>=_wapi_fd_reserve, when fstat(2) fails, when the file sharing fails,
when the WAPI handle can't be allocated...

The only time `filename' isn't freed is when CreateFile() succeeds, and
that's because it's stored into the file_handle.filename field, which in
turn is copied into the `handle' pointer returned to the caller.

So I'm not seeing the memory leak you're referring to...

 - Jon

More information about the Mono-devel-list mailing list