in reply to Re: Inline::C & Strawberry: can't free a buffer allocated with asprintf
in thread Inline::C & Strawberry: can't free a buffer allocated with asprintf

Thank you everyone for answers. Either of #undef free or __mingw_str_free(s); indeed work as expected (don't die, do de-allocate). In the end, asprintf brings more mess than convenience in this environment, so I'd rather revert to manual allocation/concatenation etc. :)

Replies are listed 'Best First'.
Re^3: Inline::C & Strawberry: can't free a buffer allocated with asprintf
by bliako (Abbot) on Jan 02, 2020 at 12:12 UTC

    asprintf is just one of many functions in C which will allocate memory and expect the caller to free it, so this is bound to happen again with other functions. Using __mingw_str_free() will cause portability issues.