aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-05-30 16:28:29 +0000
committerTom Tromey <tromey@redhat.com>2013-05-30 16:28:29 +0000
commitfe48dfb1ce26560b351cc9fbaed38e69f4ba89db (patch)
treeb7864aa1b522a5e8fc401b118a23045723c3f001 /gdb
parent27833de78f4f6b7c96482732e3b09b5b9a370e0f (diff)
downloadgdb-fe48dfb1ce26560b351cc9fbaed38e69f4ba89db.zip
gdb-fe48dfb1ce26560b351cc9fbaed38e69f4ba89db.tar.gz
gdb-fe48dfb1ce26560b351cc9fbaed38e69f4ba89db.tar.bz2
fix cleanups in som_symtab_read
This fixes som_symtab_read not to leak cleanups. * somread.c (som_symtab_read): Call do_cleanups.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/somread.c5
2 files changed, 8 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 86c6369..2345ff8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2013-05-30 Tom Tromey <tromey@redhat.com>
+ * somread.c (som_symtab_read): Call do_cleanups.
+
+2013-05-30 Tom Tromey <tromey@redhat.com>
+
* printcmd.c (print_command_1): Unconditionally call do_cleanups.
2013-05-30 Tom Tromey <tromey@redhat.com>
diff --git a/gdb/somread.c b/gdb/somread.c
index db6c4d4..6c6cc14 100644
--- a/gdb/somread.c
+++ b/gdb/somread.c
@@ -46,6 +46,7 @@ static void
som_symtab_read (bfd *abfd, struct objfile *objfile,
struct section_offsets *section_offsets)
{
+ struct cleanup *cleanup;
struct gdbarch *gdbarch = get_objfile_arch (objfile);
unsigned int number_of_symbols;
int val, dynamic;
@@ -65,7 +66,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
We avoid using alloca because the memory size could be so large
that we could hit the stack size limit. */
buf = xmalloc (symsize * number_of_symbols);
- make_cleanup (xfree, buf);
+ cleanup = make_cleanup (xfree, buf);
bfd_seek (abfd, obj_som_sym_filepos (abfd), SEEK_SET);
val = bfd_bread (buf, symsize * number_of_symbols, abfd);
if (val != symsize * number_of_symbols)
@@ -316,6 +317,8 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
section),
objfile);
}
+
+ do_cleanups (cleanup);
}
/* Scan and build partial symbols for a symbol file.