Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by syphilis (Archbishop)
on Jan 02, 2020 at 01:53 UTC ( [id://11110854]=note: print w/replies, xml ) Need Help??


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

Hi,

For me, replacing:
free(s); with: __mingw_str_free(s);
seems to work fine.
( I assume that it is actually freeing the memory, but I haven't checked. )

According to https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-crt/misc/mingw_mbwc_convert.c, __mingw_str_free is:
void __cdecl __mingw_str_free(void *ptr) { if (ptr) free(ptr); }
so something (inside perl) is apparently messing with free() in such a way that it doesn't always matter ... but does matter inside the Inline::C environment.

Cheers,
Rob

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 22:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found