This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[rfa] symfile.c - fix apparently uninitialized my_cleanups
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: [rfa] symfile.c - fix apparently uninitialized my_cleanups
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Mon, 27 Nov 2000 18:18:41 +1100
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?
Andrew
Mon 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)