2007-07-26 Michael Snyder <msnyder@access-company.com>
authorMichael Snyder <msnyder@vmware.com>
Thu, 26 Jul 2007 18:43:24 +0000 (18:43 +0000)
committerMichael Snyder <msnyder@vmware.com>
Thu, 26 Jul 2007 18:43:24 +0000 (18:43 +0000)
* coffgen.c (_bfd_coff_read_internal_relocs): If internal_relocs
are not to be cached, free the temporary buffer.

bfd/ChangeLog
bfd/coffgen.c

index 4fd7f4aa3b682bc3f1abdff7f768a98f4a480df3..54ef404bc310e6e6bf744b5443cd21a60719f41c 100644 (file)
@@ -1,5 +1,8 @@
 2007-07-26  Michael Snyder  <msnyder@access-company.com>
 
+       * coffgen.c (_bfd_coff_read_internal_relocs): If internal_relocs
+       are not to be cached, free the temporary buffer.
+
        * aoutx.h (slurp_reloc_table): Return TRUE if reloc_size == zero
        or count == zero.
 
index f4f97b3f0d798f853a6a9b61cb7e7bd4057e068c..7fad78c78f38723b70f8f14fa3370da3449ab6b3 100644 (file)
@@ -457,17 +457,22 @@ _bfd_coff_read_internal_relocs (bfd *abfd,
       free_external = NULL;
     }
 
-  if (cache && free_internal != NULL)
+  if (free_internal != NULL)
     {
-      if (coff_section_data (abfd, sec) == NULL)
+      if (cache)
+       free (free_internal);
+      else
        {
-         amt = sizeof (struct coff_section_tdata);
-         sec->used_by_bfd = bfd_zalloc (abfd, amt);
-         if (sec->used_by_bfd == NULL)
-           goto error_return;
-         coff_section_data (abfd, sec)->contents = NULL;
+         if (coff_section_data (abfd, sec) == NULL)
+           {
+             amt = sizeof (struct coff_section_tdata);
+             sec->used_by_bfd = bfd_zalloc (abfd, amt);
+             if (sec->used_by_bfd == NULL)
+               goto error_return;
+             coff_section_data (abfd, sec)->contents = NULL;
+           }
+         coff_section_data (abfd, sec)->relocs = free_internal;
        }
-      coff_section_data (abfd, sec)->relocs = free_internal;
     }
 
   return internal_relocs;