From: Pedro Alves <pedro@codesourcery.com>
To: tromey@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: RFA: open-related cleanup handling
Date: Wed, 29 Oct 2008 21:02:00 -0000 [thread overview]
Message-ID: <200810291740.14621.pedro@codesourcery.com> (raw)
In-Reply-To: <m3fxmgmqx0.fsf@fleche.redhat.com>
On Tuesday 28 October 2008 19:59:55, Tom Tromey wrote:
> Ok?
Looks OK to me.
> @@ -1553,24 +1556,21 @@ forward_search_command (char *regex, int from_tty)
> desc = open_source_file (current_source_symtab);
> if (desc < 0)
> perror_with_name (current_source_symtab->filename);
> + cleanups = make_cleanup_close (desc);
>
> if (current_source_symtab->line_charpos == 0)
> find_source_lines (current_source_symtab, desc);
>
> if (line < 1 || line > current_source_symtab->nlines)
> - {
> - close (desc);
> - error (_("Expression not found"));
> - }
> + error (_("Expression not found"));
>
> if (lseek (desc, current_source_symtab->line_charpos[line - 1], 0) < 0)
> - {
> - close (desc);
> - perror_with_name (current_source_symtab->filename);
> - }
> + perror_with_name (current_source_symtab->filename);
>
> + discard_cleanups (cleanups);
I noticed that discarding a _close cleanup is currently leaking the
xmalloc'ed int used to hold the file descriptor. Fixing it should be a
matter of doing something similar to make_cleanup_restore_integer
(using make_my_cleanup2) from inside make_cleanup_close.
Would you like to take care of that while you have your hangs
dirty doing these cleaning ups?
--
Pedro Alves
next prev parent reply other threads:[~2008-10-29 17:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-28 20:21 Tom Tromey
2008-10-29 21:02 ` Pedro Alves [this message]
2008-10-30 21:53 ` Tom Tromey
2008-10-30 21:32 ` Pedro Alves
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200810291740.14621.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.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