Make bfd_byte an int8_t, flagword a uint32_t
[binutils-gdb.git] / bfd / peicode.h
index f1f3ce815331041d3bebf30fdc3e74bab292f20d..e2e2be65b5d1c097b1718f9f58d91b1ff9c7bb2c 100644 (file)
@@ -576,7 +576,7 @@ pe_ILF_make_a_symbol (pe_ILF_vars *  vars,
   esym = vars->esym_ptr;
 
   /* Copy the symbol's name into the string table.  */
-  sprintf (vars->string_ptr, "%s%s", prefix, symbol_name);
+  int len = sprintf (vars->string_ptr, "%s%s", prefix, symbol_name);
 
   if (section == NULL)
     section = bfd_und_section_ptr;
@@ -612,7 +612,7 @@ pe_ILF_make_a_symbol (pe_ILF_vars *  vars,
   vars->table_ptr ++;
   vars->native_ptr ++;
   vars->esym_ptr ++;
-  vars->string_ptr += strlen (symbol_name) + strlen (prefix) + 1;
+  vars->string_ptr += len + 1;
 
   BFD_ASSERT (vars->string_ptr < vars->end_string_ptr);
 }
@@ -1158,6 +1158,17 @@ pe_ILF_build_a_bfd (bfd *            abfd,
   return false;
 }
 
+/* Cleanup function, returned from check_format hook.  */
+
+static void
+pe_ILF_cleanup (bfd *abfd)
+{
+  struct bfd_in_memory *bim = abfd->iostream;
+  free (bim->buffer);
+  free (bim);
+  abfd->iostream = NULL;
+}
+
 /* We have detected an Import Library Format archive element.
    Decode the element and return the appropriate target.  */
 
@@ -1331,7 +1342,7 @@ pe_ILF_object_p (bfd * abfd)
       return NULL;
     }
 
-  return _bfd_no_cleanup;
+  return pe_ILF_cleanup;
 }
 
 static void