Hello,

Andy Wingo <wi...@pobox.com> writes:

> On Mon 21 Feb 2011 21:50, l...@gnu.org (Ludovic Courtès) writes:
>
>>> --- a/libguile/ports.c
>>> +++ b/libguile/ports.c
>>> @@ -661,6 +661,19 @@ scm_i_remove_port (SCM port)
>>>    scm_port_non_buffer (p);
>>>    p->putback_buf = NULL;
>>>    p->putback_buf_size = 0;
>>> +
>>> +  if (p->input_cd != (iconv_t) -1)
>>> +    {
>>> +      iconv_close (p->input_cd);
>>> +      p->input_cd = (iconv_t) -1;
>>> +    }
>>> +  
>>> +  if (p->output_cd != (iconv_t) -1)
>>> +    {
>>> +      iconv_close (p->output_cd);
>>> +      p->output_cd = (iconv_t) -1;
>>> +    }
>>> +
>>
>> I don’t think this is needed: each port has a finalizer,
>> ‘finalize_port’, which normally takes care of this, eventually.
>
> It is needed, but only in the case that you `close-port' explicitly.
> The block in finalize_port only takes care of gc'd open ports.

Right.  Closed ports are eventually GC’d, so in that sense it is not
strictly needed, but OK.

Valgrind was wrong!  ;-)

Ludo’.

Reply via email to