Imported from libpng-0.82.tar
diff --git a/pngmem.c b/pngmem.c
index c115e4c..2ae261e 100644
--- a/pngmem.c
+++ b/pngmem.c
@@ -1,5 +1,5 @@
 
-/* pngstub.c - stub functions for i/o and memory allocation
+/* pngmem.c - stub functions for memory allocation
 
    libpng 1.0 beta 2 - version 0.81
    For conditions of distribution and use, see copyright notice in png.h
@@ -61,7 +61,7 @@
 
 #ifdef PNG_MAX_MALLOC_64K
    if (size > (png_uint_32)65536L)
-      png_error(png_ptr, "Cannot Allocate > 64K");
+      (*(png_ptr->error_fn))(png_ptr, "Cannot Allocate > 64K");
 #endif
 
 #ifdef __TURBOC__
@@ -99,11 +99,11 @@
             num_save_array = 1;
             save_array = malloc(num_save_array * sizeof (borland_seg));
             if (!save_array)
-               png_error(png_ptr, "Out of Memory 1");
+               (*(png_ptr->error_fn))(png_ptr, "Out of Memory 1");
             save_array->mem_ptr = farmalloc(
                (unsigned long)(NUM_SEG) * 65536L + 65532L);
             if (!save_array->mem_ptr)
-               png_error(png_ptr, "Out of Memory 2");
+               (*(png_ptr->error_fn))(png_ptr, "Out of Memory 2");
             offset = (unsigned long)(ret);
             offset &= 0xffffL;
             ptr = save_array->mem_ptr;
@@ -141,11 +141,11 @@
             save_array = realloc(save_array,
                (num_save_array + 1) * sizeof (borland_seg));
             if (!save_array)
-               png_error(png_ptr, "Out of Memory 3");
+               (*(png_ptr->error_fn))(png_ptr, "Out of Memory 3");
             save_array[num_save_array].mem_ptr = farmalloc(
                (unsigned long)(NUM_SEG) * 65536L + 65532L);
             if (!save_array[num_save_array].mem_ptr)
-               png_error(png_ptr, "Out of Memory 4");
+               (*(png_ptr->error_fn))(png_ptr, "Out of Memory 4");
             offset = (unsigned long)(ret);
             offset &= 0xffffL;
             ptr = save_array[num_save_array].mem_ptr;
@@ -180,7 +180,7 @@
 
    if (ret == NULL)
    {
-      png_error(png_ptr, "Out of Memory");
+      (*(png_ptr->error_fn))(png_ptr, "Out of Memory");
    }
 
    return ret;
@@ -259,14 +259,14 @@
 
 #ifdef PNG_MAX_MALLOC_64K
    if (size > (png_uint_32)65536L)
-      png_error(png_ptr, "Cannot Allocate > 64K");
+      (*(png_ptr->error_fn))(png_ptr, "Cannot Allocate > 64K");
 #endif
 
    ret = malloc((png_size_t)size);
 
    if (!ret)
    {
-      png_error(png_ptr, "Out of Memory 6");
+      (*(png_ptr->error_fn))(png_ptr, "Out of Memory 6");
    }
 
    return ret;
@@ -285,14 +285,14 @@
 
 #ifdef PNG_MAX_MALLOC_64K
    if (size > (png_uint_32)65536L)
-      png_error(png_ptr, "Cannot Allocate > 64K");
+      (*(png_ptr->error_fn))(png_ptr, "Cannot Allocate > 64K");
 #endif
 
    ret = realloc(ptr, (png_size_t)size);
 
    if (!ret)
    {
-      png_error(png_ptr, "Out of Memory 7");
+      (*(png_ptr->error_fn))(png_ptr, "Out of Memory 7");
    }
 
    return ret;