[PATCH] libga68: Don't call free on gc-allocated strings
Pietro Monteiro
pietro@sociotechnical.xyz
Thu Jan 29 15:18:55 GMT 2026
On Wed, Jan 28, 2026, at 8:13 PM, Jose E. Marchesi wrote:
> Hi Pietro.
> Thanks for the patch.
>
>> _libga68_u32_to_u8 called free on the result buffer on error, but the
>> buffer is allocated by the GC, so calling free on it is incorrect.
>
> But if LIBGA68_WITH_GC is not defined then _libga68_malloc_leaf used the
> regular malloc, right? So the memory needs to be free or we will be
> leaking memory..
If libga68 is built without the gc we always leak memory anyway.
> Wouldn't it be better to make these functions always use
> _libga68_malloc_internal and _libga68_malloc_free instead?
It would. I'll give it a stab at using malloc_internal in u32_to_u8
and freeing in the callers.
pietro
More information about the Algol68
mailing list