diff options
author | Tom Tromey <tromey@redhat.com> | 2012-10-19 15:51:53 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-10-19 15:51:53 +0000 |
commit | 06c2e2c12cb88e092a8f82f20d0b8fa6407759d1 (patch) | |
tree | 352a71acb4c9090721d631ba8dc73cf19737237c /bfd/compress.c | |
parent | 99c7d5a8233b80280c513788c0de7f26c8f8d6ec (diff) | |
download | gdb-06c2e2c12cb88e092a8f82f20d0b8fa6407759d1.zip gdb-06c2e2c12cb88e092a8f82f20d0b8fa6407759d1.tar.gz gdb-06c2e2c12cb88e092a8f82f20d0b8fa6407759d1.tar.bz2 |
* compress.c (bfd_get_full_section_contents): Don't cache
decompressed contents.
Diffstat (limited to 'bfd/compress.c')
-rw-r--r-- | bfd/compress.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/bfd/compress.c b/bfd/compress.c index 17b5928..34faa08 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: |