thpatch / win32_utf8

Transparent UTF-8 support for native Win32 ANSI applications
The Unlicense
99 stars 7 forks source link

Fixing Memory Leaks #8

Closed bluecataudio closed 3 years ago

bluecataudio commented 3 years ago
  1. Because modified strlen never returns 0, functions that receive NULL strings have a two bytes leak everytime.
  2. Missing a call to free in comdlg32
DankRank commented 3 years ago

Regarding WCHAR_T_CONV, the reason it didn't do VLA_FREE, is because it actually does nothing for memory blocks smaller than 1024-sizeof(size_t) bytes (such blocks are allocated on stack, and are cleaned up automatically). However, in debug builds it always allocates on heap, and thus leaks.

I've fixed up spacing in your commit (you've used spaces instead of tabs) and merged it.

bluecataudio commented 3 years ago

Thanks!