+2020-01-26  Tom Tromey  <tom@tromey.com>
+
+       * psymtab.h (class psymtab_storage) <install_psymtab>: Rename from
+       allocate_psymtab.  Update documentation.
+       * psymtab.c (psymtab_storage::install_psymtab): Rename from
+       allocate_psymtab.  Do not use new.
+       (allocate_psymtab): Use new.  Update.
+
 2020-01-26  Tom Tromey  <tom@tromey.com>
 
        * xcoffread.c (xcoff_psymtab_to_symtab_1): Update.
 
 
 /* See psymtab.h.  */
 
-struct partial_symtab *
-psymtab_storage::allocate_psymtab ()
+void
+psymtab_storage::install_psymtab (partial_symtab *pst)
 {
-  struct partial_symtab *psymtab = new struct partial_symtab;
-
-  psymtab->next = psymtabs;
-  psymtabs = psymtab;
-
-  return psymtab;
+  pst->next = psymtabs;
+  psymtabs = pst;
 }
 
 \f
 struct partial_symtab *
 allocate_psymtab (const char *filename, struct objfile *objfile)
 {
-  struct partial_symtab *psymtab
-    = objfile->partial_symtabs->allocate_psymtab ();
+  struct partial_symtab *psymtab = new partial_symtab;
+  objfile->partial_symtabs->install_psymtab (psymtab);
 
   psymtab->filename
     = ((const char *) objfile->per_bfd->filename_cache.insert
 
     return OBSTACK_CALLOC (obstack (), number, struct partial_symtab *);
   }
 
-  /* Allocate a new psymtab on the psymtab obstack.  The new psymtab
-     will be linked in to the "psymtabs" list, but otherwise all other
-     fields will be zero.  */
+  /* Install a psymtab on the psymtab list.  This transfers ownership
+     of PST to this object.  */
 
-  struct partial_symtab *allocate_psymtab ();
+  void install_psymtab (partial_symtab *pst);
 
   typedef next_adapter<struct partial_symtab> partial_symtab_range;