unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: "Andy Wingo" <wingo@pobox.com>
Cc: guile-devel@gnu.org
Subject: Re: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.0-4-g3e05fc0
Date: Mon, 21 Feb 2011 21:50:11 +0100	[thread overview]
Message-ID: <878vx96rjw.fsf@gnu.org> (raw)
In-Reply-To: <E1PqVCx-0003xM-4I@vcs-noshell.in.savannah.gnu.org> (Andy Wingo's message of "Fri, 18 Feb 2011 18:37:35 +0000")

Hi!

"Andy Wingo" <wingo@pobox.com> writes:

>     fix a couple leaks in ports.c.  thanks valgrind!
>     
>     * libguile/ports.c (scm_i_remove_port): Fix a case in which ports
>       explictly closed via close-port would leak their iconv_t data.
>       (scm_set_port_encoding_x): scm_i_set_port_encoding_x strdups its
>       argument, so we need to free the locale encoding of the incoming str.

Good catch!

> --- 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.

Thanks,
Ludo’.



       reply	other threads:[~2011-02-21 20:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1PqVCx-0003xM-4I@vcs-noshell.in.savannah.gnu.org>
2011-02-21 20:50 ` Ludovic Courtès [this message]
2011-02-21 21:19   ` [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.0-4-g3e05fc0 Andy Wingo
2011-02-22 11:36     ` Ludovic Courtès
2011-02-22 19:11       ` Andy Wingo
2011-02-22 20:35         ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878vx96rjw.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=wingo@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).