Iñáki Baz Castillo wrote:
> 
> It's a small piece of C code, no more. Do you mean that I shouldn't use 
> "malloc"/"free" in a Ruby C extension?
> 

Of course you can. Just be prepared to free the memory before raising an 
exception. Also check out Ruby's xmalloc and xfree. These functions act 
like malloc and free but the memory will be garbage collected when Ruby 
determines that there are no more references to it.