Imported from libpng-1.0.6e.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index 250ceb4..c366e8e 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,12 +1,12 @@
 
-Libpng 1.0.6d - April 7, 2000
+Libpng 1.0.6e - April 10, 2000
 
 This is not intended to be a public release.  It will be replaced
 within a few weeks by a public version or by another test version.
 
 Changes since the last public release (1.0.6):
 
-version 1.0.6d [April 7, 2000]
+version 1.0.6d [April 8, 2000]
   Changed sprintf() to strcpy() in png_write_sCAL_s() to work without STDIO
   Added data_length parameter to png_decompress_chunk() function
   Revised documentation to remove reference to abandoned png_free_chnk functions
@@ -15,6 +15,22 @@
   Renamed makefile.ibmvac3 to makefile.ibmc, added libpng.icc IBM project file
   Added a check for info_ptr->free_me&PNG_FREE_TEXT when free'ing text in png.c
   Simplify png_sig_bytes() function to remove use of non-ISO-C strdup().
+version 1.0.6e [April 10, 2000]
+  Added png_data_freer() function.
+  In the code that checks for over-length tRNS chunks, added check of
+    info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann)
+  Minor revisions of libpng.txt/libpng.3.
+  Check for existing data and free it if the free_me flag is set, in png_set_*()
+    and png_handle_*().
+  Only define PNG_WEIGHTED_FILTERS_SUPPORTED when PNG_FLOATING_POINT_SUPPORTED
+    is defined.
+  Changed several instances of PNG_NO_CONSOLE_ID to PNG_NO_STDIO in pngrutil.c
+    and mentioned the purposes of the two macros in libpng.txt/libpng.3.
+
+Send comments/corrections/commendations to
+png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
+
+Glenn R-P
 
 Send comments/corrections/commendations to
 png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
diff --git a/CHANGES b/CHANGES
index f7e8b8f..aca9085 100644
--- a/CHANGES
+++ b/CHANGES
@@ -669,6 +669,17 @@
   Renamed makefile.ibmvac3 to makefile.ibmc, added libpng.icc IBM project file
   Added a check for info_ptr->free_me&PNG_FREE_TEXT when free'ing text in png.c
   Simplify png_sig_bytes() function to remove use of non-ISO-C strdup().
+version 1.0.6e [April 10, 2000]
+  Added png_data_freer() function.
+  In the code that checks for over-length tRNS chunks, added check of
+    info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann)
+  Minor revisions of libpng.txt/libpng.3.
+  Check for existing data and free it if the free_me flag is set, in png_set_*()
+    and png_handle_*().
+  Only define PNG_WEIGHTED_FILTERS_SUPPORTED when PNG_FLOATING_POINT_SUPPORTED
+    is defined.
+  Changed several instances of PNG_NO_CONSOLE_ID to PNG_NO_STDIO in pngrutil.c
+    and mentioned the purposes of the two macros in libpng.txt/libpng.3.
 
 Send comments/corrections/commendations to
 png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
diff --git a/INSTALL b/INSTALL
index 7527b40..9ae0352 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,5 @@
 
-Installing libpng version 1.0.6d - April 7, 2000
+Installing libpng version 1.0.6e - April 10, 2000
 
 Before installing libpng, you must first install zlib.  zlib
 can usually be found wherever you got libpng.  zlib can be
@@ -10,7 +10,7 @@
 version of zlib that's installed.
 
 You can rename the directories that you downloaded (they
-might be called "libpng-1.0.6d" or "lpng106" and "zlib-1.1.3"
+might be called "libpng-1.0.6e" or "lpng106" and "zlib-1.1.3"
 or "zlib113") so that you have directories called "zlib" and "libpng".
 
 Your directory structure should look like this:
@@ -47,8 +47,8 @@
 include
 
  makefile.std      =>  Generic UNIX makefile (cc, creates static libpng.a)
- makefile.linux    =>  Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6d)
- makefile.gcmmx    =>  Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6d,
+ makefile.linux    =>  Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6e)
+ makefile.gcmmx    =>  Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6e,
                        uses assembler code tuned for Intel MMX platform)
  makefile.gcc      =>  Generic makefile (gcc, creates static libpng.a)
  makefile.knr      =>  Archaic UNIX Makefile that converts files with
@@ -59,9 +59,9 @@
  makefile.ibmc     =>  IBM C/C++ version 3.x for Win32 and OS/2 (static)
  libpng.icc        =>  Project file for IBM VisualAge/C++ version 4.0 or later
  makefile.sgi      =>  Silicon Graphics IRIX makefile (cc, creates static lib)
- makefile.sggcc    =>  Silicon Graphics (gcc, creates libpng.so.2.1.0.6d)
+ makefile.sggcc    =>  Silicon Graphics (gcc, creates libpng.so.2.1.0.6e)
  makefile.sunos    =>  Sun makefile
- makefile.solaris  =>  Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.6d)
+ makefile.solaris  =>  Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.6e)
  makefile.sco      =>  For SCO OSr5  ELF and Unixware 7 with Native cc
  makefile.mips     =>  MIPS makefile
  makefile.acorn    =>  Acorn makefile
diff --git a/LICENSE b/LICENSE
index 62edb6c..4915dda 100644
--- a/LICENSE
+++ b/LICENSE
@@ -5,7 +5,7 @@
 Copyright (c) 1996, 1997 Andreas Dilger
 (libpng versions 0.90, December 1996, through 0.96, May 1997)
 Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
-(libpng versions 0.97, January 1998, through 1.0.6d, April 7, 2000)
+(libpng versions 0.97, January 1998, through 1.0.6e, April 10, 2000)
 
 For the purposes of this copyright and license, "Contributing Authors"
 is defined as the following set of individuals:
@@ -68,4 +68,4 @@
 
 Glenn Randers-Pehrson
 randeg@alum.rpi.edu
-April 7, 2000
+April 10, 2000
diff --git a/README b/README
index ae314d4..46c5772 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng 1.0.6d - April 7, 2000 (shared library 2.1)
+README for libpng 1.0.6e - April 10, 2000 (shared library 2.1)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
@@ -172,9 +172,9 @@
        descrip.mms      =>  VMS makefile for MMS or MMK
        makefile.std     =>  Generic UNIX makefile (cc, creates static libpng.a)
        makefile.linux   =>  Linux/ELF makefile
-                            (gcc, creates libpng.so.2.1.0.6d)
+                            (gcc, creates libpng.so.2.1.0.6e)
        makefile.gcmmx   =>  Linux/ELF makefile (gcc, creates
-                            libpng.so.2.1.0.6d, uses assembler code
+                            libpng.so.2.1.0.6e, uses assembler code
                             tuned for Intel MMX platform)
        makefile.gcc     =>  Generic makefile (gcc, creates static libpng.a)
        makefile.knr     =>  Archaic UNIX Makefile that converts files with
@@ -185,10 +185,10 @@
        makefile.ibmc    =>  IBM C/C++ version 3.x for Win32 and OS/2 (static)
        libpng.icc       =>  Project file, IBM VisualAge/C++ 4.0 or later
        makefile.sgi     =>  Silicon Graphics IRIX (cc, creates static lib)
-       makefile.sggcc   =>  Silicon Graphics (gcc, creates libpng.so.2.1.0.6d)
+       makefile.sggcc   =>  Silicon Graphics (gcc, creates libpng.so.2.1.0.6e)
        makefile.sunos   =>  Sun makefile
        makefile.solaris =>  Solaris 2.X makefile
-                            (gcc, creates libpng.so.2.1.0.6d)
+                            (gcc, creates libpng.so.2.1.0.6e)
        makefile.sco     =>  For SCO OSr5  ELF and Unixware 7 with Native cc
        makefile.mips    =>  MIPS makefile
        makefile.acorn   =>  Acorn makefile
diff --git a/Y2KINFO b/Y2KINFO
index 0eb3078..d676175 100644
--- a/Y2KINFO
+++ b/Y2KINFO
@@ -1,13 +1,13 @@
    Y2K compliance in libpng:
    =========================
 
-      April 7, 2000
+      April 10, 2000
 
       Since the PNG Development group is an ad-hoc body, we can't make
       an official declaration.
 
       This is your unofficial assurance that libpng from version 0.71 and
-      upward through 1.0.6d are Y2K compliant.  It is my belief that earlier
+      upward through 1.0.6e are Y2K compliant.  It is my belief that earlier
       versions were also Y2K compliant.
 
       Libpng only has three year fields.  One is a 2-byte unsigned integer
diff --git a/configure b/configure
index ac7714e..916cc35 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 echo "
-  There is no \"configure\" script for Libpng-1.0.6d.  Instead, please
+  There is no \"configure\" script for Libpng-1.0.6e.  Instead, please
   copy the appropriate makefile for your system from the \"scripts\"
   directory.  Read the INSTALL file for more details.
 "
diff --git a/libpng.3 b/libpng.3
index ea8a91b..e6c7c6f 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,6 +1,6 @@
-.TH LIBPNG 3 "April 7, 2000"
+.TH LIBPNG 3 "April 10, 2000"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6d
+libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6e
 .SH SYNOPSIS
 \fI\fB
 
@@ -713,7 +713,7 @@
 .SH LIBPNG.TXT
 libpng.txt - A description on how to use and modify libpng
 
- libpng version 1.0.6d - April 7, 2000
+ libpng version 1.0.6e - April 10, 2000
  Updated and distributed by Glenn Randers-Pehrson
  <randeg@alum.rpi.edu>
  Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -1054,7 +1054,7 @@
 transformation flags.  This call is equivalent to png_read_info(),
 followed the set of transformations indicated by the transform mask,
 followed by png_update_info(), followed by a read of the image bytes
-to the info member `rowpointers', followed by png_read_end().
+to the info_ptr, followed by png_read_end().
 
 (The final parameter of this call is not yet used.  Someday it
 will point to transformation parameters.)
@@ -1827,7 +1827,6 @@
                    PNG_FREE_PLTE, PNG_FREE_TRNS,
                    PNG_FREE_HIST, PNG_FREE_ICCP,
                    PNG_FREE_SPLT, PNG_FREE_ROWS,
-                   PNG_FREE_PCAL, PNG_FREE_SCAL,
                    PNG_FREE_TEXT, PNG_FREE_UNKN,
                    or simply PNG_FREE_ALL
     n            - sequence number of item to be freed
@@ -1841,6 +1840,26 @@
 -1, and multiple items are allowed for the data type identified in
 the mask, such as text or splt, only the n'th item is freed.
 
+The default behavior is only to free data that was allocated internally
+by libpng.  This can be changed, so that libpng will not free the data,
+or so that it will also free data that was passed in via a png_set_*()
+function, with
+
+    png_data_freer(png_ptr, info_ptr, freer, mask)
+    mask     - which data elements are affected
+               same choices as in png_free_data()
+    freer    - one of
+                 PNG_DESTROY_WILL_FREE_DATA
+                 PNG_SET_WILL_FREE_DATA
+                 PNG_USER_WILL_FREE_DATA
+
+This function only affects data that has already been allocated.
+You can call this function after reading the PNG data but before calling
+any png_set_*() functions, to control whether the user or the png_set_*()
+function is responsible for freeing any existing data that might be present,
+and again after the png_set_*() functions to control whether the user
+or png_destroy_*() is supposed to free the data..
+
 For a more compact example of reading a PNG image, see the file example.c.
 
 .SS Reading PNG files progressively
@@ -2439,7 +2458,7 @@
 At this point there are two ways to proceed; through the high-level
 write interface, or through a sequence of low-level write operations.
 You can use the high-level interface if your image data is present
-on the rowpointers member of the info structure.  All defined output
+in the info structure.  All defined output
 transformations are permitted, enabled by the following masks.
 
     PNG_TRANSFORM_IDENTITY      No transformation
@@ -2453,15 +2472,15 @@
     PNG_TRANSFORM_SWAP_ENDIAN   Byte-swap 16-bit samples
     PNG_TRANSFORM_STRIP_FILLER  Strip out filler bytes.
 
-If you have valid image data on the rowpointers member, simply do this:
+If you have valid image data in the info structure, simply do this:
 
     png_write_png(png_ptr, info_ptr, png_transforms, NULL)
 
 where png_transforms is an integer containing the logical-or of some set of
 transformation flags.  This call is equivalent to png_write_info(),
 followed by the set of transformations indicated by the transform
-mask, followed by followed by a write of the image bytes from the info
-member `rowpointers', followed by png_write_end().
+mask, followed by followed by a write of the image bytes from the
+info_ptr, followed by png_write_end().
 
 (The final parameter of this call is not yet used.  Someday it
 may point to output transformation parameters.)
@@ -2719,7 +2738,6 @@
                    PNG_FREE_PLTE, PNG_FREE_TRNS,
                    PNG_FREE_HIST, PNG_FREE_ICCP,
                    PNG_FREE_SPLT, PNG_FREE_ROWS,
-                   PNG_FREE_PCAL, PNG_FREE_SCAL,
                    PNG_FREE_TEXT, PNG_FREE_UNKN,
                    or simply PNG_FREE_ALL
     n            - sequence number of item to be freed
@@ -2736,6 +2754,35 @@
 png_set_*, you must not free it until just before the call to
 png_destroy_write_struct().
 
+The default behavior is only to free data that was allocated internally
+by libpng.  This can be changed, so that libpng will not free the data,
+or so that it will free data that was passed in via a png_set_*() function,
+with
+
+    png_data_freer(png_ptr, info_ptr, freer, mask)
+    mask     - which data elements are affected
+               same choices as in png_free_data()
+    freer    - one of
+                 PNG_DESTROY_WILL_FREE_DATA
+                 PNG_SET_WILL_FREE_DATA
+                 PNG_USER_WILL_FREE_DATA
+
+For example, to transfer responsibility for some data from a read structure
+to a write structure, you could use
+
+    png_data_freer(read_ptr, read_info_ptr,
+       PNG_USER_WILL_FREE_DATA,
+       PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST)
+    png_data_freer(write_ptr, write_info_ptr,
+       PNG_DESTROY_WILL_FREE_DATA,
+       PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST)
+
+Thereby briefly reassigning responsibility for freeing to the user but
+immediately afterwards reassigning it once more to the write_destroy
+function.  Having done this, it would then be safe to destroy the read
+structure and continue to use the PLTE, tRNS, and hIST data in the write
+structure.
+
 For a more compact example of writing a PNG image, see the file example.c.
 
 .SH V. Modifying/Customizing libpng:
@@ -2801,11 +2848,13 @@
 On non-fatal errors, png_warning() is called
 to print a warning message, and then control returns to the calling code.
 By default png_error() and png_warning() print a message on stderr via
-fprintf() unless the library is compiled with PNG_NO_STDIO defined.  If
-you wish to change the behavior of the error functions, you will need to
-set up your own message callbacks.  These functions are normally supplied
-at the time that the png_struct is created.  It is also possible to change
-these functions after png_create_*_struct() has been called by calling:
+fprintf() unless the library is compiled with PNG_NO_CONSOLE_IO defined
+(because you don't want the messages) or PNG_NO_STDIO defined (because
+fprintf() isn't available).  If you wish to change the behavior of the error
+functions, you will need to set up your own message callbacks.  These
+functions are normally supplied at the time that the png_struct is created.
+It is also possible to change these functions after png_create_*_struct()
+has been called by calling:
 
     png_set_error_fn(png_structp png_ptr,
         png_voidp error_ptr, png_error_ptr error_fn,
@@ -3108,13 +3157,13 @@
 
 .SH VII. Y2K Compliance in libpng
 
-April 7, 2000
+April 10, 2000
 
 Since the PNG Development group is an ad-hoc body, we can't make
 an official declaration.
 
 This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.0.6d are Y2K compliant.  It is my belief that earlier
+upward through 1.0.6e are Y2K compliant.  It is my belief that earlier
 versions were also Y2K compliant.
 
 Libpng only has three year fields.  One is a 2-byte unsigned integer that
@@ -3255,7 +3304,7 @@
 
 Thanks to Frank J. T. Wojcik for helping with the documentation.
 
-Libpng version 1.0.6d - April 7, 2000:
+Libpng version 1.0.6e - April 10, 2000:
 Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
 Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
 
@@ -3270,7 +3319,7 @@
 Copyright (c) 1996, 1997 Andreas Dilger
 (libpng versions 0.89c, May 1996, through 0.96, May 1997)
 Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
-(libpng versions 0.97, January 1998, through 1.0.6d, April 7, 2000)
+(libpng versions 0.97, January 1998, through 1.0.6e, April 10, 2000)
 
 For the purposes of this copyright and license, "Contributing Authors"
 is defined as the following set of individuals:
diff --git a/libpng.txt b/libpng.txt
index 9594952..5a8643e 100644
--- a/libpng.txt
+++ b/libpng.txt
@@ -1,6 +1,6 @@
 libpng.txt - A description on how to use and modify libpng
 
- libpng version 1.0.6d - April 7, 2000
+ libpng version 1.0.6e - April 10, 2000
  Updated and distributed by Glenn Randers-Pehrson
  <randeg@alum.rpi.edu>
  Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -341,7 +341,7 @@
 transformation flags.  This call is equivalent to png_read_info(),
 followed the set of transformations indicated by the transform mask,
 followed by png_update_info(), followed by a read of the image bytes
-to the info member `rowpointers', followed by png_read_end().
+to the info_ptr, followed by png_read_end().
 
 (The final parameter of this call is not yet used.  Someday it
 will point to transformation parameters.)
@@ -1114,7 +1114,6 @@
                    PNG_FREE_PLTE, PNG_FREE_TRNS,
                    PNG_FREE_HIST, PNG_FREE_ICCP,
                    PNG_FREE_SPLT, PNG_FREE_ROWS,
-                   PNG_FREE_PCAL, PNG_FREE_SCAL,
                    PNG_FREE_TEXT, PNG_FREE_UNKN,
                    or simply PNG_FREE_ALL
     n            - sequence number of item to be freed
@@ -1128,6 +1127,26 @@
 -1, and multiple items are allowed for the data type identified in
 the mask, such as text or splt, only the n'th item is freed.
 
+The default behavior is only to free data that was allocated internally
+by libpng.  This can be changed, so that libpng will not free the data,
+or so that it will also free data that was passed in via a png_set_*()
+function, with
+
+    png_data_freer(png_ptr, info_ptr, freer, mask)
+    mask     - which data elements are affected
+               same choices as in png_free_data()
+    freer    - one of
+                 PNG_DESTROY_WILL_FREE_DATA
+                 PNG_SET_WILL_FREE_DATA
+                 PNG_USER_WILL_FREE_DATA
+
+This function only affects data that has already been allocated.
+You can call this function after reading the PNG data but before calling
+any png_set_*() functions, to control whether the user or the png_set_*()
+function is responsible for freeing any existing data that might be present,
+and again after the png_set_*() functions to control whether the user
+or png_destroy_*() is supposed to free the data..
+
 For a more compact example of reading a PNG image, see the file example.c.
 
 Reading PNG files progressively
@@ -1726,7 +1745,7 @@
 At this point there are two ways to proceed; through the high-level
 write interface, or through a sequence of low-level write operations.
 You can use the high-level interface if your image data is present
-on the rowpointers member of the info structure.  All defined output
+in the info structure.  All defined output
 transformations are permitted, enabled by the following masks.
 
     PNG_TRANSFORM_IDENTITY      No transformation
@@ -1740,15 +1759,15 @@
     PNG_TRANSFORM_SWAP_ENDIAN   Byte-swap 16-bit samples
     PNG_TRANSFORM_STRIP_FILLER  Strip out filler bytes.
 
-If you have valid image data on the rowpointers member, simply do this:
+If you have valid image data in the info structure, simply do this:
 
     png_write_png(png_ptr, info_ptr, png_transforms, NULL)
 
 where png_transforms is an integer containing the logical-or of some set of
 transformation flags.  This call is equivalent to png_write_info(),
 followed by the set of transformations indicated by the transform
-mask, followed by followed by a write of the image bytes from the info
-member `rowpointers', followed by png_write_end().
+mask, followed by followed by a write of the image bytes from the
+info_ptr, followed by png_write_end().
 
 (The final parameter of this call is not yet used.  Someday it
 may point to output transformation parameters.)
@@ -2006,7 +2025,6 @@
                    PNG_FREE_PLTE, PNG_FREE_TRNS,
                    PNG_FREE_HIST, PNG_FREE_ICCP,
                    PNG_FREE_SPLT, PNG_FREE_ROWS,
-                   PNG_FREE_PCAL, PNG_FREE_SCAL,
                    PNG_FREE_TEXT, PNG_FREE_UNKN,
                    or simply PNG_FREE_ALL
     n            - sequence number of item to be freed
@@ -2023,6 +2041,35 @@
 png_set_*, you must not free it until just before the call to
 png_destroy_write_struct().
 
+The default behavior is only to free data that was allocated internally
+by libpng.  This can be changed, so that libpng will not free the data,
+or so that it will free data that was passed in via a png_set_*() function,
+with
+
+    png_data_freer(png_ptr, info_ptr, freer, mask)
+    mask     - which data elements are affected
+               same choices as in png_free_data()
+    freer    - one of
+                 PNG_DESTROY_WILL_FREE_DATA
+                 PNG_SET_WILL_FREE_DATA
+                 PNG_USER_WILL_FREE_DATA
+
+For example, to transfer responsibility for some data from a read structure
+to a write structure, you could use
+
+    png_data_freer(read_ptr, read_info_ptr,
+       PNG_USER_WILL_FREE_DATA,
+       PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST)
+    png_data_freer(write_ptr, write_info_ptr,
+       PNG_DESTROY_WILL_FREE_DATA,
+       PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST)
+
+Thereby briefly reassigning responsibility for freeing to the user but
+immediately afterwards reassigning it once more to the write_destroy
+function.  Having done this, it would then be safe to destroy the read
+structure and continue to use the PLTE, tRNS, and hIST data in the write
+structure.
+
 For a more compact example of writing a PNG image, see the file example.c.
 
 V. Modifying/Customizing libpng:
@@ -2088,11 +2135,13 @@
 On non-fatal errors, png_warning() is called
 to print a warning message, and then control returns to the calling code.
 By default png_error() and png_warning() print a message on stderr via
-fprintf() unless the library is compiled with PNG_NO_STDIO defined.  If
-you wish to change the behavior of the error functions, you will need to
-set up your own message callbacks.  These functions are normally supplied
-at the time that the png_struct is created.  It is also possible to change
-these functions after png_create_*_struct() has been called by calling:
+fprintf() unless the library is compiled with PNG_NO_CONSOLE_IO defined
+(because you don't want the messages) or PNG_NO_STDIO defined (because
+fprintf() isn't available).  If you wish to change the behavior of the error
+functions, you will need to set up your own message callbacks.  These
+functions are normally supplied at the time that the png_struct is created.
+It is also possible to change these functions after png_create_*_struct()
+has been called by calling:
 
     png_set_error_fn(png_structp png_ptr,
         png_voidp error_ptr, png_error_ptr error_fn,
@@ -2395,13 +2444,13 @@
 
 VII. Y2K Compliance in libpng
 
-April 7, 2000
+April 10, 2000
 
 Since the PNG Development group is an ad-hoc body, we can't make
 an official declaration.
 
 This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.0.6d are Y2K compliant.  It is my belief that earlier
+upward through 1.0.6e are Y2K compliant.  It is my belief that earlier
 versions were also Y2K compliant.
 
 Libpng only has three year fields.  One is a 2-byte unsigned integer that
diff --git a/libpngpf.3 b/libpngpf.3
index f131cbe..0844b6d 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,6 +1,6 @@
-.TH LIBPNGPF 3 April 7, 2000
+.TH LIBPNGPF 3 April 10, 2000
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6d
+libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6e
 (private functions)
 .SH SYNOPSIS
 \fB#include <png.h>\fP
diff --git a/png.5 b/png.5
index b2c0843..979a68f 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "April 7, 2000"
+.TH PNG 5 "April 10, 2000"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
diff --git a/png.c b/png.c
index c5f8537..bd17cec 100644
--- a/png.c
+++ b/png.c
@@ -1,7 +1,7 @@
 
 /* png.c - location for general purpose libpng functions
  *
- * libpng version 1.0.6d - April 7, 2000
+ * libpng version 1.0.6e - April 10, 2000
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -14,14 +14,14 @@
 #include "png.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_0_6d Your_png_h_is_not_version_1_0_6d;
+typedef version_1_0_6e Your_png_h_is_not_version_1_0_6e;
 
 /* Version information for C files.  This had better match the version
  * string defined in png.h.  */
 
 #ifdef PNG_USE_GLOBAL_ARRAYS
 /* png_libpng_ver was changed to a function in version 1.0.5c */
-char png_libpng_ver[12] = "1.0.6d";
+char png_libpng_ver[12] = "1.0.6e";
 
 /* png_sig was changed to a function in version 1.0.5c */
 /* Place to hold the signature string for a PNG file. */
@@ -262,8 +262,25 @@
 }
 
 void
+png_data_freer(png_structp png_ptr, png_infop info_ptr,
+   int freer, png_uint_32 mask)
+{
+   png_debug(1, "in png_data_freer\n");
+   if (png_ptr == NULL || info_ptr == NULL)
+      return;
+   if(freer == PNG_DESTROY_WILL_FREE_DATA)
+      info_ptr->free_me |= mask;
+   else if(freer == PNG_USER_WILL_FREE_DATA)
+      info_ptr->free_me &= ~mask;
+   else
+      png_warning(png_ptr,
+         "Unknown freer parameter in png_data_freer.");
+}
+
+void
 png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num)
 {
+   png_debug(1, "in png_free_data\n");
    if (png_ptr == NULL || info_ptr == NULL)
       return;
 
@@ -306,7 +323,6 @@
 
 #if defined(PNG_sCAL_SUPPORTED)
 /* free any sCAL entry */
-if (mask & PNG_FREE_SCAL)
 {
    if (info_ptr->valid & PNG_INFO_sCAL)
    {
@@ -321,7 +337,6 @@
 
 #if defined(PNG_pCAL_SUPPORTED)
 /* free any pCAL entry */
-if (mask & PNG_FREE_PCAL)
 {
    if (info_ptr->valid & PNG_INFO_pCAL)
    {
@@ -484,7 +499,9 @@
 #if !defined(PNG_NO_STDIO)
 /* Initialize the default input/output functions for the PNG file.  If you
  * use your own read or write routines, you can call either png_set_read_fn()
- * or png_set_write_fn() instead of png_init_io().
+ * or png_set_write_fn() instead of png_init_io().  If you have defined
+ * PNG_NO_STDIO, you must use a function of your own because "FILE *" isn't
+ * necessarily available.
  */
 void
 png_init_io(png_structp png_ptr, FILE *fp)
@@ -544,7 +561,7 @@
 png_get_copyright(png_structp png_ptr)
 {
    if (png_ptr != NULL || png_ptr == NULL)  /* silence compiler warning */
-   return ("\n libpng version 1.0.6d - April 7, 2000\n\
+   return ("\n libpng version 1.0.6e - April 10, 2000\n\
    Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n\
    Copyright (c) 1996, 1997 Andreas Dilger\n\
    Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson\n");
@@ -562,8 +579,8 @@
 {
    /* Version of *.c files used when building libpng */
    if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
-      return("1.0.6d");
-   return("1.0.6d");
+      return("1.0.6e");
+   return("1.0.6e");
 }
 
 png_charp
diff --git a/png.h b/png.h
index d34ef1f..6312e70 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
 
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.0.6d - April 7, 2000
+ * libpng version 1.0.6e - April 10, 2000
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -9,7 +9,7 @@
  * Authors and maintainers:
  *  libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  *  libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- *  libpng versions 0.97, January 1998, through 1.0.6d - April 7, 2000: Glenn
+ *  libpng versions 0.97, January 1998, through 1.0.6e - April 10, 2000: Glenn
  *  See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
@@ -47,7 +47,7 @@
  *    1.0.5e-r                 1.0.5e-r 10100  2.1.0.5e-r (not compatible)
  *    1.0.5s-v                 1.0.5s-v 10006  2.1.0.5s-v (compatible)
  *    1.0.6 (+ 3 patches)      1.0.6    10006  2.1.0.6
- *    1.0.6d                   1.0.6d   10007  2.1.0.6d
+ *    1.0.6d-e                 1.0.6d-e 10007  2.1.0.6d-e
  *    1.0.7                    1.0.7    10007  2.1.0.7    (still compatible)
  *
  *    Henceforth the source version will match the shared-library minor
@@ -73,7 +73,7 @@
  * Copyright (c) 1996, 1997 Andreas Dilger
  * (libpng versions 0.89c, June 1996, through 0.96, May 1997)
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
- * (libpng versions 0.97, January 1998, through 1.0.6d, April 7, 2000)
+ * (libpng versions 0.97, January 1998, through 1.0.6e, April 10, 2000)
  *
  * For the purposes of this copyright and license, "Contributing Authors"
  * is defined as the following set of individuals:
@@ -148,13 +148,13 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    April 7, 2000
+ *    April 10, 2000
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
  *
  *    This is your unofficial assurance that libpng from version 0.71 and
- *    upward through 1.0.6d are Y2K compliant.  It is my belief that earlier
+ *    upward through 1.0.6e are Y2K compliant.  It is my belief that earlier
  *    versions were also Y2K compliant.
  *
  *    Libpng only has three year fields.  One is a 2-byte unsigned integer
@@ -232,7 +232,7 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.0.6d"
+#define PNG_LIBPNG_VER_STRING "1.0.6e"
 
 /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
  * We must not include leading zeros.
@@ -428,16 +428,20 @@
  * The following members may have allocated storage attached that should be
  * cleaned up before the structure is discarded: palette, trans, text,
  * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
- * splt_palettes, scal_unit, and row_pointers.   These are automatically
- * freed when the info structure is deallocated.
+ * splt_palettes, scal_unit, row_pointers, and unknowns.   By default, these are
+ * automatically freed when the info structure is deallocated, if they were
+ * allocated internally by libpng.  This behavior can be changed by means
+ * of the png_data_freer() function.
  *
  * More allocation details: all the chunk-reading functions that change these
- * members go through the corresponding png_set_* functions.  Functions to
- * clear these members are available: see png_free_*.  The png_set_* functions
- * do not depend on being able to point info structure members to any of the
- * storage they are passed (they make their own copies), EXCEPT that the
- * png_set_text function uses the same storage passed to them
- * in the text_ptr or itxt_ptr structure argument.
+ * members go through the corresponding png_set_* functions.  A function to
+ * clear these members is available: see png_free_data().   Some of the
+ * png_set_* functions do not depend on being able to point info structure
+ * members to any of the storage they are passed (they make their own copies),
+ * EXCEPT that the png_set_text functions use the same storage passed to them
+ * in the text_ptr or itxt_ptr structure argument, and the png_set_tRNS,
+ * png_set_PLTE, png_set_hIST, png_set_iCCP, png_set_rows, png_set_sPLT,
+ * and png_set_unknowns do not make their own copies.
  */
 typedef struct png_info_struct
 {
@@ -1057,9 +1061,9 @@
 };
 
 /* This prevents a compiler error in png_get_copyright() in png.c if png.c
-and png.h are both at * version 1.0.6d
+and png.h are both at * version 1.0.6e
  */
-typedef png_structp version_1_0_6d;
+typedef png_structp version_1_0_6e;
 
 typedef png_struct FAR * FAR * png_structpp;
 
@@ -1591,10 +1595,18 @@
 /* frees a pointer allocated by png_malloc() */
 extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
 
-/* free data that was allocated internally */
+/* Free data that was allocated internally */
 extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
    png_infop info_ptr, png_uint_32 free_me, int num));
-/* flags for png_ptr->free_me and info_ptr->free_me */
+/* Reassign responsibility for freeing existing data, whether allocated
+ * by libpng or by the application */
+extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, int freer, png_uint_32 mask));
+/* assignments for png_data_freer */
+#define PNG_DESTROY_WILL_FREE_DATA 1
+#define PNG_SET_WILL_FREE_DATA 1
+#define PNG_USER_WILL_FREE_DATA 2
+/* Flags for png_ptr->free_me and info_ptr->free_me */
 #define PNG_FREE_PLTE 0x0001
 #define PNG_FREE_TRNS 0x0002
 #define PNG_FREE_TEXT 0x0004
@@ -1602,8 +1614,8 @@
 #define PNG_FREE_ICCP 0x0010
 #define PNG_FREE_SPLT 0x0020
 #define PNG_FREE_ROWS 0x0040
-#define PNG_FREE_PCAL 0x0080
-#define PNG_FREE_SCAL 0x0100
+#define PNG_FREE_PCAL 0x0080 /* not used any more */
+#define PNG_FREE_SCAL 0x0100 /* not used any more */
 #define PNG_FREE_UNKN 0x0200
 #define PNG_FREE_LIST 0x0400
 #define PNG_FREE_ALL  0x07ff
@@ -2032,7 +2044,7 @@
 extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
 
 #define PNG_HEADER_VERSION_STRING \
-   " libpng version 1.0.6d - April 7, 2000 (header)\n"
+   " libpng version 1.0.6e - April 10, 2000 (header)\n"
 
 #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
 /* With these routines we avoid an integer divide, which will be slower on
diff --git a/pngasmrd.h b/pngasmrd.h
index 16565ff..200347e 100644
--- a/pngasmrd.h
+++ b/pngasmrd.h
@@ -1,6 +1,6 @@
 /* pngasmrd.h - assembler version of utilities to read a PNG file
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1999, 2000 Glenn Randers-Pehrson
  *
diff --git a/pngconf.h b/pngconf.h
index a0b4354..508dbb3 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
 
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -255,7 +255,7 @@
  * things to happen if the library and/or application ever change.
  */
 
-/* Any transformations you will not be using can be undef'ed here */
+/* Any features you will not be using can be undef'ed here */
 
 /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
    to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
@@ -267,7 +267,13 @@
    1.0.1c, for consistency)
  */
 
+#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
+#define PNG_FLOATING_POINT_SUPPORTED
+#endif
 
+#ifndef PNG_NO_FIXED_POINT_SUPPORTED
+#define PNG_FIXED_POINT_SUPPORTED
+#endif
 
 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
     !defined(PNG_NO_READ_TRANSFORMS)
@@ -387,7 +393,8 @@
                                             encoders, but can cause trouble
                                             if left undefined */
 
-#ifndef PNG_NO_WRITE_WEIGHTED_FILTER
+#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
+     defined(PNG_FLOATING_POINT_SUPPORTED)
 #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
 #endif
 
@@ -428,14 +435,6 @@
 #define PNG_ASSEMBLER_CODE_SUPPORTED
 #endif
 
-#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
-#define PNG_FLOATING_POINT_SUPPORTED
-#endif
-
-#ifndef PNG_NO_FIXED_POINT_SUPPORTED
-#define PNG_FIXED_POINT_SUPPORTED
-#endif
-
 /* Do not use global arrays (helps with building DLL's)
  * They are no longer used in libpng itself, since version 1.0.5c,
  * but might be required for some pre-1.0.5c applications.
diff --git a/pngerror.c b/pngerror.c
index 053794a..2d2e04c 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -1,7 +1,7 @@
 
 /* pngerror.c - stub functions for i/o and memory allocation
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pnggccrd.c b/pnggccrd.c
index 2c60d7f..b816ada 100644
--- a/pnggccrd.c
+++ b/pnggccrd.c
@@ -6,7 +6,7 @@
  *     and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
  *     for Intel's performance analysis of the MMX vs. non-MMX code.
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, Intel Corporation
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
diff --git a/pngget.c b/pngget.c
index 6e320fd..ba2c647 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,7 +1,7 @@
 
 /* pngget.c - retrieval of values from info struct
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pngmem.c b/pngmem.c
index f8a7e40..c290fd6 100644
--- a/pngmem.c
+++ b/pngmem.c
@@ -1,7 +1,7 @@
 
 /* pngmem.c - stub functions for memory allocation
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pngpread.c b/pngpread.c
index abd3916..f74eaef 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1,7 +1,7 @@
 
 /* pngpread.c - read a png file in push mode
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pngread.c b/pngread.c
index a24e7da..563faa9 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,7 +1,7 @@
 
 /* pngread.c - read a PNG file
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -641,7 +641,7 @@
  * not called png_set_interlace_handling(), the display_row buffer will
  * be ignored, so pass NULL to it.
  *
- * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6d.
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6e.
  */
 
 void
@@ -690,7 +690,7 @@
  * only call this function once.  If you desire to have an image for
  * each pass of a interlaced image, use png_read_rows() instead.
  *
- * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6d.
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6e.
  */
 void
 png_read_image(png_structp png_ptr, png_bytepp image)
diff --git a/pngrio.c b/pngrio.c
index f95859c..627af0f 100644
--- a/pngrio.c
+++ b/pngrio.c
@@ -1,7 +1,7 @@
 
 /* pngrio.c - functions for data input
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pngrtran.c b/pngrtran.c
index f0c6d11..4272344 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -1,7 +1,7 @@
 
 /* pngrtran.c - transforms the data in a row for PNG readers
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pngrutil.c b/pngrutil.c
index 3d637dc..9d08d13 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,7 +1,7 @@
 
 /* pngrutil.c - utilities to read a PNG file
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -392,8 +392,9 @@
    }
 
    num = (int)length / 3;
+
    palette = (png_colorp)png_zalloc(png_ptr, (uInt)num, sizeof (png_color));
-   png_ptr->free_me |= PNG_FREE_PLTE;
+
    for (i = 0; i < num; i++)
    {
       png_byte buf[3];
@@ -431,7 +432,6 @@
          else
          {
             png_chunk_warning(png_ptr, "CRC error");
-            png_ptr->free_me &= ~PNG_FREE_PLTE;
             png_zfree(png_ptr, palette);
             return;
          }
@@ -445,6 +445,9 @@
 #endif
    png_ptr->palette = palette;
    png_ptr->num_palette = (png_uint_16)num;
+
+   png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
+   png_ptr->free_me |= PNG_FREE_PLTE;
    png_set_PLTE(png_ptr, info_ptr, palette, num);
 
 #if defined (PNG_READ_tRNS_SUPPORTED)
@@ -452,10 +455,15 @@
    {
       if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
       {
-         if (png_ptr->num_trans > png_ptr->num_palette)
+         if (png_ptr->num_trans > (png_uint_16)num)
          {
             png_warning(png_ptr, "Truncating incorrect tRNS chunk length");
-            png_ptr->num_trans = png_ptr->num_palette;
+            png_ptr->num_trans = (png_uint_16)num;
+         }
+         if (info_ptr->num_trans > (png_uint_16)num)
+         {
+            png_warning(png_ptr, "Truncating incorrect info tRNS chunk length");
+            info_ptr->num_trans = (png_uint_16)num;
          }
       }
    }
@@ -543,7 +551,7 @@
       {
          png_warning(png_ptr,
            "Ignoring incorrect gAMA value when sRGB is also present");
-#ifndef PNG_NO_CONSOLE_IO
+#ifndef PNG_NO_STDIO
          fprintf(stderr, "gamma = (%d/100000)\n", (int)igamma);
 #endif
          return;
@@ -753,7 +761,7 @@
 
             png_warning(png_ptr,
               "Ignoring incorrect cHRM value when sRGB is also present");
-#ifndef PNG_NO_CONSOLE_IO
+#ifndef PNG_NO_STDIO
 #ifdef PNG_FLOATING_POINT_SUPPORTED
             fprintf(stderr,"wx=%f, wy=%f, rx=%f, ry=%f\n",
                white_x, white_y, red_x, red_y);
@@ -765,7 +773,7 @@
             fprintf(stderr,"gx=%ld, gy=%ld, bx=%ld, by=%ld\n",
                int_x_green, int_y_green, int_x_blue, int_y_blue);
 #endif
-#endif /* PNG_NO_CONSOLE_IO */
+#endif /* PNG_NO_STDIO */
          }
          png_crc_finish(png_ptr, 0);
          return;
@@ -848,7 +856,7 @@
       {
          png_warning(png_ptr,
            "Ignoring incorrect gAMA value when sRGB is also present");
-#ifndef PNG_NO_CONSOLE_IO
+#ifndef PNG_NO_STDIO
 #  ifdef PNG_FIXED_POINT_SUPPORTED
          fprintf(stderr,"incorrect gamma=(%d/100000)\n",(int)png_ptr->int_gamma);
 #  else
@@ -923,7 +931,6 @@
 #endif
 
    chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
-   png_ptr->free_me |= PNG_FREE_ICCP;
    slength = (png_size_t)length;
    png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
 
@@ -1103,7 +1110,6 @@
       }
 
       png_ptr->trans = (png_bytep)png_malloc(png_ptr, length);
-      png_ptr->free_me |= PNG_FREE_TRNS;
       png_crc_read(png_ptr, png_ptr->trans, (png_size_t)length);
       png_ptr->num_trans = (png_uint_16)length;
    }
@@ -1149,6 +1155,8 @@
    if (png_crc_finish(png_ptr, 0))
       return;
 
+   png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
+   png_ptr->free_me |= PNG_FREE_TRNS;
    png_set_tRNS(png_ptr, info_ptr, png_ptr->trans, png_ptr->num_trans,
       &(png_ptr->trans_values));
 }
@@ -1283,7 +1291,6 @@
    num = (int)length / 2 ;
    png_ptr->hist = (png_uint_16p)png_malloc(png_ptr,
       (png_uint_32)(num * sizeof (png_uint_16)));
-   png_ptr->free_me |= PNG_FREE_HIST;
    for (i = 0; i < num; i++)
    {
       png_byte buf[2];
@@ -1295,6 +1302,8 @@
    if (png_crc_finish(png_ptr, 0))
       return;
 
+   png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
+   png_ptr->free_me |= PNG_FREE_HIST;
    png_set_hIST(png_ptr, info_ptr, png_ptr->hist);
 }
 #endif
diff --git a/pngset.c b/pngset.c
index b740afa..b11d70d 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,7 +1,7 @@
 
 /* pngset.c - storage of image information into info struct
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -425,6 +425,7 @@
    if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
       return;
 
+   png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0);
    info_ptr->iccp_name = png_malloc(png_ptr, png_strlen(name)+1);
    strcpy(info_ptr->iccp_name, name);
    info_ptr->iccp_profile = png_malloc(png_ptr, proflen);
@@ -754,8 +755,8 @@
    if (png_ptr == NULL || info_ptr == NULL)
       return;
 
+   png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0);
    info_ptr->row_pointers = row_pointers;
-   info_ptr->free_me |= PNG_FREE_ROWS;
 }
 #endif
 
diff --git a/pngtest.c b/pngtest.c
index b44085c..fbd8b16 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,7 +1,7 @@
 
 /* pngtest.c - a simple test program to test libpng
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -1344,4 +1344,4 @@
 }
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_0_6d your_png_h_is_not_version_1_0_6d;
+typedef version_1_0_6e your_png_h_is_not_version_1_0_6e;
diff --git a/pngtrans.c b/pngtrans.c
index 19d2b23..b1f83f5 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -1,7 +1,7 @@
 
 /* pngtrans.c - transforms the data in a row (used by both readers and writers)
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pngvcrd.c b/pngvcrd.c
index ff0f733..cfee16e 100644
--- a/pngvcrd.c
+++ b/pngvcrd.c
@@ -2,7 +2,7 @@
  *
  * For Intel x86 CPU and Microsoft Visual C++ compiler
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, Intel Corporation
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
diff --git a/pngwio.c b/pngwio.c
index a426252..a5a5a77 100644
--- a/pngwio.c
+++ b/pngwio.c
@@ -1,7 +1,7 @@
 
 /* pngwio.c - functions for data output
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pngwrite.c b/pngwrite.c
index f66bb31..347bda5 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,7 +1,7 @@
 
 /* pngwrite.c - general routines to write a PNG file
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pngwtran.c b/pngwtran.c
index a1f12cf..e698479 100644
--- a/pngwtran.c
+++ b/pngwtran.c
@@ -1,7 +1,7 @@
 
 /* pngwtran.c - transforms the data in a row for PNG writers
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pngwutil.c b/pngwutil.c
index 0306f95..25bc8ce 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,7 +1,7 @@
 
 /* pngwutil.c - utilities to write a PNG file
  *
- * libpng 1.0.6d - April 7, 2000
+ * libpng 1.0.6e - April 10, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/scripts/makefile.beos b/scripts/makefile.beos
index cd9ab65..90efb5b 100644
--- a/scripts/makefile.beos
+++ b/scripts/makefile.beos
@@ -31,7 +31,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.6d
+PNGMIN = 1.0.6e
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 # where make install puts libpng.a, libpng.so*, and png.h
diff --git a/scripts/makefile.dec b/scripts/makefile.dec
index 8e29c8a..8850e97 100644
--- a/scripts/makefile.dec
+++ b/scripts/makefile.dec
@@ -14,7 +14,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.6d
+PNGMIN = 1.0.6e
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 CC=cc
diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx
index 581252a..7036f73 100644
--- a/scripts/makefile.gcmmx
+++ b/scripts/makefile.gcmmx
@@ -34,7 +34,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.6d
+PNGMIN = 1.0.6e
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.linux b/scripts/makefile.linux
index ad506ca..99acfba 100644
--- a/scripts/makefile.linux
+++ b/scripts/makefile.linux
@@ -34,7 +34,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.6d
+PNGMIN = 1.0.6e
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.sco b/scripts/makefile.sco
index 9843301..c37d3f8 100644
--- a/scripts/makefile.sco
+++ b/scripts/makefile.sco
@@ -25,7 +25,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.6d
+PNGMIN = 1.0.6e
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc
index 6853d24..3e2229b 100644
--- a/scripts/makefile.sggcc
+++ b/scripts/makefile.sggcc
@@ -19,8 +19,8 @@
 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
 LDSHARED=gcc -shared
 
-VER=1.0.6d
-LIBS=libpng.so.1.0.6d
+VER=1.0.6e
+LIBS=libpng.so.1.0.6e
 SHAREDLIB=libpng.so
 libdir=$(prefix)/lib32
 
diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris
index df82e4b..5f00e81 100644
--- a/scripts/makefile.solaris
+++ b/scripts/makefile.solaris
@@ -31,7 +31,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.6d
+PNGMIN = 1.0.6e
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/pngdef.pas b/scripts/pngdef.pas
index 31642ab..c380ab0 100644
--- a/scripts/pngdef.pas
+++ b/scripts/pngdef.pas
@@ -3,7 +3,7 @@
 interface
 
 const
-  PNG_LIBPNG_VER_STRING = '1.0.6d';
+  PNG_LIBPNG_VER_STRING = '1.0.6e';
   PNG_LIBPNG_VER        =  10007;
 
 type