* jit.c (jit_object_close_impl): Don't malloc the objfile

name.
	* objfiles.c (allocate_objfile): Don't malloc the objfile
	name.
	(free_objfile): Don't free the objfile name.
	* objfiles.h (struct objfile) <name>: Update comment.
	* symfile.c (reread_symbols): Fix reference counting.  Don't
	malloc objfile name.
This commit is contained in:
Tom Tromey
2012-08-22 16:44:45 +00:00
parent 1c00ec6b06
commit e1507e953e
5 changed files with 27 additions and 12 deletions

View File

@@ -271,7 +271,7 @@ allocate_objfile (bfd *abfd, int flags)
/* Look up the gdbarch associated with the BFD. */
objfile->gdbarch = gdbarch_from_bfd (abfd);
objfile->name = xstrdup (bfd_get_filename (abfd));
objfile->name = bfd_get_filename (abfd);
objfile->mtime = bfd_get_mtime (abfd);
/* Build section table. */
@@ -279,7 +279,7 @@ allocate_objfile (bfd *abfd, int flags)
}
else
{
objfile->name = xstrdup ("<<anonymous objfile>>");
objfile->name = "<<anonymous objfile>>";
}
objfile->per_bfd = get_objfile_bfd_data (objfile, abfd);
@@ -670,7 +670,6 @@ free_objfile (struct objfile *objfile)
/* The last thing we do is free the objfile struct itself. */
xfree (objfile->name);
if (objfile->global_psymbols.list)
xfree (objfile->global_psymbols.list);
if (objfile->static_psymbols.list)