This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [rfa] symfile.c - fix apparently uninitialized my_cleanups



To close the thread. I have checked this in.

2001-02-19  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>

        From Andrew Cagney  <cagney@b1.cygnus.com>:
	* symfile.c (add_symbol_file_command): Always initialize
 	my_cleanup using a NULL cleanup.

Elena


Andrew Cagney writes:
 > Hello,
 > 
 > I think the attatched is correct.  ``my_cleanups'' was always
 > initialized but in a somewhat obscure way.  It probably illustrates a
 > better way of doing cleanups for a function - unconditionally setup the
 > cleanup at the very start.
 > 
 > Ok?
 > 	AndrewMon Nov 27 18:19:46 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 > 
 > 	* symfile.c (add_symbol_file_command): Always initialize
 >  	my_cleanup using a NULL cleanup.
 > 
 > Index: symfile.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/symfile.c,v
 > retrieving revision 1.20
 > diff -p -r1.20 symfile.c
 > *** symfile.c	2000/10/27 15:02:42	1.20
 > --- symfile.c	2000/11/27 07:22:03
 > *************** add_symbol_file_command (char *args, int
 > *** 1416,1422 ****
 >     } sect_opts[SECT_OFF_MAX];
 >   
 >     struct section_addr_info section_addrs;
 > !   struct cleanup *my_cleanups;
 >   
 >     dont_repeat ();
 >   
 > --- 1417,1423 ----
 >     } sect_opts[SECT_OFF_MAX];
 >   
 >     struct section_addr_info section_addrs;
 > !   struct cleanup *my_cleanups = make_cleanup (null_cleanup, NULL);
 >   
 >     dont_repeat ();
 >   
 > *************** add_symbol_file_command (char *args, int
 > *** 1452,1458 ****
 >   	{
 >   	  /* The first argument is the file name. */
 >   	  filename = tilde_expand (arg);
 > ! 	  my_cleanups = make_cleanup (free, filename);
 >   	}
 >         else
 >   	if (argcnt == 1)
 > --- 1453,1459 ----
 >   	{
 >   	  /* The first argument is the file name. */
 >   	  filename = tilde_expand (arg);
 > ! 	  make_cleanup (free, filename);
 >   	}
 >         else
 >   	if (argcnt == 1)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]