in reply to Re: XS malloc and free
in thread XS malloc and free

The api documentation states clearly:
The user is responsible for calling free() on the value.
and example C-programs call it and it works :-(

And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
(Terry Pratchett, Small Gods)