Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Fix double free
Date: Sat, 18 Jul 2009 18:00:00 -0000	[thread overview]
Message-ID: <4A6167BD.7080804@redhat.com> (raw)
In-Reply-To: <e394668d0907172008v2b7d95b4oeec5f1a1d8ef02f7@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 355 bytes --]

On 07/17/2009 08:08 PM, Doug Evans wrote:
> The problem occurs twice in reverse_search_command as well.

Indeed it does! I did not even look!

Updated patch attached.

Keith

ChangeLog
2009-07-17  Keith Seitz  <keiths@redhat.com>

	* source.c (forward_search_command): Don't fclose the stream,
	just run the cleanups.
	(reverse_search_command): Likewise.

[-- Attachment #2: cleanup-buglet.patch --]
[-- Type: text/plain, Size: 1246 bytes --]

Index: source.c
===================================================================
RCS file: /cvs/src/src/gdb/source.c,v
retrieving revision 1.102
diff -u -p -r1.102 source.c
--- source.c	6 Jul 2009 18:23:47 -0000	1.102
+++ source.c	18 Jul 2009 05:54:17 -0000
@@ -1612,7 +1612,7 @@ forward_search_command (char *regex, int
       if (re_exec (buf) > 0)
 	{
 	  /* Match! */
-	  fclose (stream);
+	  do_cleanups (cleanups);
 	  print_source_lines (current_source_symtab, line, line + 1, 0);
 	  set_internalvar_integer (lookup_internalvar ("_"), line);
 	  current_source_line = max (line - lines_to_list / 2, 1);
@@ -1690,7 +1690,7 @@ reverse_search_command (char *regex, int
       if (re_exec (buf) > 0)
 	{
 	  /* Match! */
-	  fclose (stream);
+	  do_cleanups (cleanups);
 	  print_source_lines (current_source_symtab, line, line + 1, 0);
 	  set_internalvar_integer (lookup_internalvar ("_"), line);
 	  current_source_line = max (line - lines_to_list / 2, 1);
@@ -1699,7 +1699,7 @@ reverse_search_command (char *regex, int
       line--;
       if (fseek (stream, current_source_symtab->line_charpos[line - 1], 0) < 0)
 	{
-	  fclose (stream);
+	  do_cleanups (cleanups);
 	  perror_with_name (current_source_symtab->filename);
 	}
     }

  reply	other threads:[~2009-07-18  6:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-18  0:53 Keith Seitz
2009-07-18  6:12 ` Doug Evans
2009-07-18 18:00   ` Keith Seitz [this message]
2009-07-21  3:19     ` Doug Evans
2009-07-24  3:11       ` Keith Seitz

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=4A6167BD.7080804@redhat.com \
    --to=keiths@redhat.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /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