[Shards-general] [PATCH 0/4] minor, small improvements

Daniel Berger djberg96 at gmail.com
Mon Apr 4 12:37:35 EDT 2011


<snip>
>
> You call malloc(), but never return the actual free()-able pointer
> back.  I'm not sure how existing code uses it, but the following
> diff (along with using DL.free) makes it usable.
>
> The rb_sys_fail() path still makes it dangerous, though.

I've fixed that, thanks. If the pread function fails, I now free the
malloc'ed memory first before the rb_sys_fail call.

I'm wondering if there's a more elegant solution vs free'ing the
memory manually. Perhaps a custom close function? Or a finalizer?

BTW, I'm not sure about xmalloc. Is that going to work without the GNU
toolchain? If so I'm afraid I'll have to stick with the standard
malloc.

Regards,

Dan


More information about the shards-general mailing list