diff options
author | Tom Tromey <tromey@redhat.com> | 2013-05-30 16:28:28 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-05-30 16:28:28 +0000 |
commit | b86531d6abb565e5973706271b514c8b92e7629b (patch) | |
tree | 7737975277724f4d9d592b2c501b838dea81e6e4 /gdb/somread.c | |
parent | 8b50a13a31f4ef572b16144fe832bcd2fd08ece7 (diff) | |
download | gdb-b86531d6abb565e5973706271b514c8b92e7629b.tar.gz |
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/somread.c')
-rw-r--r-- | gdb/somread.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/somread.c b/gdb/somread.c index db6c4d441e9..6c6cc14c117 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. |