Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Fix double free
@ 2009-07-18  0:53 Keith Seitz
  2009-07-18  6:12 ` Doug Evans
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Seitz @ 2009-07-18  0:53 UTC (permalink / raw)
  To: gdb-patches

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

Hi,

An insight user (yes, there are still a few of us ;-) noticed that 
insight would crash when using gdb's "search" command. Turns out this is 
a simple cleanup buglet. I think it is easier to read the patch than 
explain, so I'll leave it at that.

Ok?
Keith

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

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


[-- Attachment #2: cleanup-buglet.patch --]
[-- Type: text/plain, Size: 614 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	17 Jul 2009 20:08:38 -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);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Fix double free
  2009-07-18  0:53 [RFA] Fix double free Keith Seitz
@ 2009-07-18  6:12 ` Doug Evans
  2009-07-18 18:00   ` Keith Seitz
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Evans @ 2009-07-18  6:12 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches

On Fri, Jul 17, 2009 at 3:55 PM, Keith Seitz<keiths@redhat.com> wrote:
> Hi,
>
> An insight user (yes, there are still a few of us ;-) noticed that insight
> would crash when using gdb's "search" command. Turns out this is a simple
> cleanup buglet. I think it is easier to read the patch than explain, so I'll
> leave it at that.
>
> Ok?
> Keith
>
> ChangeLog
> 2009-07-17  Keith Seitz  <keiths@redhat.com>
>
>        * source.c (forward_search_command): Don't fclose the stream,
>        just run the cleanups.

Hi.

Looks right to me.

The problem occurs twice in reverse_search_command as well.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Fix double free
  2009-07-18  6:12 ` Doug Evans
@ 2009-07-18 18:00   ` Keith Seitz
  2009-07-21  3:19     ` Doug Evans
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Seitz @ 2009-07-18 18:00 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

[-- 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);
 	}
     }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Fix double free
  2009-07-18 18:00   ` Keith Seitz
@ 2009-07-21  3:19     ` Doug Evans
  2009-07-24  3:11       ` Keith Seitz
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Evans @ 2009-07-21  3:19 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches

On Fri, Jul 17, 2009 at 11:12 PM, Keith Seitz<keiths@redhat.com> wrote:
> 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.
>

"works for me".

Thanks, please check in.
[Heh, after this many years it's weird saying that.]


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Fix double free
  2009-07-21  3:19     ` Doug Evans
@ 2009-07-24  3:11       ` Keith Seitz
  0 siblings, 0 replies; 5+ messages in thread
From: Keith Seitz @ 2009-07-24  3:11 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

On 07/20/2009 06:33 PM, Doug Evans wrote:

> Thanks, please check in.

Committed.

> [Heh, after this many years it's weird saying that.]

:-)

Keith


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-07-23 23:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-18  0:53 [RFA] Fix double free Keith Seitz
2009-07-18  6:12 ` Doug Evans
2009-07-18 18:00   ` Keith Seitz
2009-07-21  3:19     ` Doug Evans
2009-07-24  3:11       ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox