Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Inline::C & Strawberry: can't free a buffer allocated with asprintf

by Corion (Pope)
on Jan 01, 2020 at 19:08 UTC ( #11110842=note: print w/replies, xml ) Need Help??


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

Most likely, free() has been replaced/redefined to another function, maybe because this Perl was compiled with -Dusemymalloc. I'm not sure how you can get back the "original" free(), but maybe even a simple #undefine free already is enough?

Replies are listed 'Best First'.
Re^2: Inline::C & Strawberry: can't free a buffer allocated with asprintf
by vr (Curate) on Jan 02, 2020 at 11:45 UTC

    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. :)

      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11110842]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2020-05-26 13:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (150 votes). Check out past polls.

    Notices?