aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-10-19 15:51:50 +0000
committerTom Tromey <tromey@redhat.com>2012-10-19 15:51:50 +0000
commit3ba55606cb40baca5fda4c0704303ad038480512 (patch)
tree0903332159290290ff4a6a5e528a2baba672e124
parent889f73fdb5bec852e083f47703f31592ef3ee77b (diff)
downloadbinutils-3ba55606cb40baca5fda4c0704303ad038480512.tar.gz
* compress.c (bfd_get_full_section_contents): Don't cache
decompressed contents.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/compress.c15
2 files changed, 12 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 5c7e869d2..ab216bd42 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-19 Tom Tromey <tromey@redhat.com>
+
+ * compress.c (bfd_get_full_section_contents): Don't cache
+ decompressed contents.
+
2012-10-18 Kai Tietz <ktietz@redhat.com>
PR binutils/14067
diff --git a/bfd/compress.c b/bfd/compress.c
index 17b5928a0..34faa088f 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -165,7 +165,6 @@ 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)
@@ -220,24 +219,24 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
if (!ret)
goto fail_compressed;
- uncompressed_buffer = (bfd_byte *) bfd_malloc (uncompressed_size);
- if (uncompressed_buffer == NULL)
+ if (p == NULL)
+ p = (bfd_byte *) bfd_malloc (uncompressed_size);
+ if (p == NULL)
goto fail_compressed;
if (!decompress_contents (compressed_buffer, compressed_size,
- uncompressed_buffer, uncompressed_size))
+ p, uncompressed_size))
{
bfd_set_error (bfd_error_bad_value);
- free (uncompressed_buffer);
+ free (p);
fail_compressed:
free (compressed_buffer);
return FALSE;
}
free (compressed_buffer);
- sec->contents = uncompressed_buffer;
- sec->compress_status = COMPRESS_SECTION_DONE;
- /* Fall thru */
+ *ptr = p;
+ return TRUE;
#endif
case COMPRESS_SECTION_DONE: