* dwarf2read.c (zlib_decompress_section): Use a cleanup.
authorTom Tromey <tromey@redhat.com>
Wed, 17 Jun 2009 20:29:42 +0000 (20:29 +0000)
committerTom Tromey <tromey@redhat.com>
Wed, 17 Jun 2009 20:29:42 +0000 (20:29 +0000)
gdb/ChangeLog
gdb/dwarf2read.c

index 67558075502287f9d4defed5ffbc299152707162..3e178ae14fcf10e8a3a57fe63c5ab1a8d58f0c49 100644 (file)
@@ -1,3 +1,7 @@
+2009-06-17  Tom Tromey  <tromey@redhat.com>
+
+       * dwarf2read.c (zlib_decompress_section): Use a cleanup.
+
 2009-06-17  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * gdbarch.sh (pointer_to_address): Change to type 'm'.
index ae8870c262fc253a682a12a21a0deda99ca93343..f02d65fab42750c9f06a0560d736407d5b958b9b 100644 (file)
@@ -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