]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/coffread.c
Replace some xmalloc-family functions with XNEW-family ones
[thirdparty/binutils-gdb.git] / gdb / coffread.c
index c0f42670e72e9df24de996031a1f0e2f27f476a9..a5033d1666a8d26c06ad8cc768318eecd2a11345 100644 (file)
@@ -253,8 +253,7 @@ coff_locate_sections (bfd *abfd, asection *sectp, void *csip)
        {
          struct stab_section_list *n, **pn;
 
-         n = ((struct stab_section_list *)
-              xmalloc (sizeof (struct stab_section_list)));
+         n = XNEW (struct stab_section_list);
          n->section = sectp;
          n->next = NULL;
          for (pn = &csi->stabsects; *pn != NULL; pn = &(*pn)->next)
@@ -841,9 +840,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
   if (type_vector)             /* Get rid of previous one.  */
     xfree (type_vector);
   type_vector_length = INITIAL_TYPE_VECTOR_LENGTH;
-  type_vector = (struct type **)
-    xmalloc (type_vector_length * sizeof (struct type *));
-  memset (type_vector, 0, type_vector_length * sizeof (struct type *));
+  type_vector = XCNEWVEC (struct type *, type_vector_length);
 
   coff_start_symtab (objfile, "");
 
@@ -2102,7 +2099,7 @@ coff_read_struct_type (int index, int length, int lastsym,
        case C_MOU:
 
          /* Get space to record the next field's data.  */
-         newobj = (struct nextfield *) alloca (sizeof (struct nextfield));
+         newobj = XALLOCA (struct nextfield);
          newobj->next = list;
          list = newobj;
 
@@ -2119,7 +2116,7 @@ coff_read_struct_type (int index, int length, int lastsym,
        case C_FIELD:
 
          /* Get space to record the next field's data.  */
-         newobj = (struct nextfield *) alloca (sizeof (struct nextfield));
+         newobj = XALLOCA (struct nextfield);
          newobj->next = list;
          list = newobj;