* compress.c: Revert previous patch.
authorTom Tromey <tromey@redhat.com>
Fri, 19 Oct 2012 16:59:57 +0000 (16:59 +0000)
committerTom Tromey <tromey@redhat.com>
Fri, 19 Oct 2012 16:59:57 +0000 (16:59 +0000)
bfd/ChangeLog
bfd/compress.c

index ab216bd4204e07bc70bbf172613fdc856cdba33b..76d91c2d15d7252ab88ac040d8086cd7dc16c6b4 100644 (file)
@@ -1,3 +1,7 @@
+2012-10-19  Tom Tromey  <tromey@redhat.com>
+
+       * compress.c: Revert previous patch.
+
 2012-10-19  Tom Tromey  <tromey@redhat.com>
 
        * compress.c (bfd_get_full_section_contents): Don't cache
index 34faa088fd411657ce077927bd9d176d590db6cf..17b5928a026b0b7c080c5f23f71c340f94e7194c 100644 (file)
@@ -165,6 +165,7 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
   bfd_size_type uncompressed_size;
   bfd_size_type rawsize;
   bfd_byte *compressed_buffer;
+  bfd_byte *uncompressed_buffer;
 #endif
 
   if (abfd->direction != write_direction && sec->rawsize != 0)
@@ -219,24 +220,24 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
       if (!ret)
        goto fail_compressed;
 
-      if (p == NULL)
-       p = (bfd_byte *) bfd_malloc (uncompressed_size);
-      if (p == NULL)
+      uncompressed_buffer = (bfd_byte *) bfd_malloc (uncompressed_size);
+      if (uncompressed_buffer == NULL)
        goto fail_compressed;
 
       if (!decompress_contents (compressed_buffer, compressed_size,
-                               p, uncompressed_size))
+                               uncompressed_buffer, uncompressed_size))
        {
          bfd_set_error (bfd_error_bad_value);
-         free (p);
+         free (uncompressed_buffer);
        fail_compressed:
          free (compressed_buffer);
          return FALSE;
        }
 
       free (compressed_buffer);
-      *ptr = p;
-      return TRUE;
+      sec->contents = uncompressed_buffer;
+      sec->compress_status = COMPRESS_SECTION_DONE;
+      /* Fall thru */
 #endif
 
     case COMPRESS_SECTION_DONE: