From: Tom Tromey Date: Wed, 17 Jun 2009 20:29:42 +0000 (+0000) Subject: * dwarf2read.c (zlib_decompress_section): Use a cleanup. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=affddf13813eefe252c923001e09e7582adb8cfd;p=binutils-gdb.git * dwarf2read.c (zlib_decompress_section): Use a cleanup. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 67558075502..3e178ae14fc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2009-06-17 Tom Tromey + + * dwarf2read.c (zlib_decompress_section): Use a cleanup. + 2009-06-17 Ulrich Weigand * gdbarch.sh (pointer_to_address): Change to type 'm'. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index ae8870c262f..f02d65fab42 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1208,6 +1208,7 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, #else bfd_size_type compressed_size = bfd_get_section_size (sectp); gdb_byte *compressed_buffer = xmalloc (compressed_size); + struct cleanup *cleanup = make_cleanup (xfree, compressed_buffer); bfd_size_type uncompressed_size; gdb_byte *uncompressed_buffer; z_stream strm; @@ -1264,7 +1265,7 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, error (_("Dwarf Error: concluding DWARF uncompression in '%s': %d"), bfd_get_filename (abfd), rc); - xfree (compressed_buffer); + do_cleanups (cleanup); *outbuf = uncompressed_buffer; *outsize = uncompressed_size; #endif