That allocation is done inside FormatMessage because it knows the
required string size. It seems that only inside FormatMessage you will know
exactly the string size.

  That link simply allocates a static string with a very large buffer.

Best,
Scuri


Em sex., 28 de fev. de 2020 às 14:31, Ranier Vilela <ranier_...@hotmail.com>
escreveu:

> Hi,
> The msvc function FormatMessage with param FORMAT_MESSAGE_ALLOCATE_BUFFER,
> has memory leak.
>
> DrMemory report this:
> Error #4: LEAK 264 direct bytes 0x0403ca20-0x0403cb28 + 0 indirect bytes
> # 0 replace_RtlAllocateHeap
>  [d:\drmemory_package\common\alloc_replace.c:3771]
> # 1 combase.dll!WindowsGetStringRawBuffer  +0x2626   (0x758cebc7
> <combase.dll+0xeebc7>)
> # 2 combase.dll!WindowsGetStringRawBuffer  +0x217d   (0x758ce71e
> <combase.dll+0xee71e>)
> # 3 combase.dll!CoInitializeEx             +0x41     (0x758c6012
> <combase.dll+0xe6012>)
> # 4 iup.dll!iupwinShowLastError            +0xf1     (0x67387462
> <iup.dll+0x87462>)
> # 5 iup.dll!IupOpen                        +0xac     (0x6734eacd
> <iup.dll+0x4eacd>)
> # 6 main                                    [C:\usr\src\workshop\app.c:135]
>
> See too at:
> https://github.com/fluent/fluent-bit/pull/1577/files
>
> Is possible use a local fixed buffer, and avoid use
> FORMAT_MESSAGE_ALLOCATE_BUFFER?
> How big it should be to fit the biggest message?
>
> regards,
> Ranier Vilela
>
> _______________________________________________
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to