png_free_ptr free_fn = NULL; png_voidp mem_ptr = NULL;
png_free_ptr free_fn; png_voidp mem_ptr;
png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,   png_infopp end_info_ptr_ptr){   png_structp png_ptr = NULL;   png_infop info_ptr = NULL, end_info_ptr = NULL;#ifdef PNG_USER_MEM_SUPPORTED   png_free_ptr free_fn = NULL;   png_voidp mem_ptr = NULL;#endif   png_debug(1, "in png_destroy_read_struct\n");   if (png_ptr_ptr != NULL)      png_ptr = *png_ptr_ptr;   if (info_ptr_ptr != NULL)      info_ptr = *info_ptr_ptr;   if (end_info_ptr_ptr != NULL)      end_info_ptr = *end_info_ptr_ptr;#ifdef PNG_USER_MEM_SUPPORTED   free_fn = png_ptr->free_fn;   mem_ptr = png_ptr->mem_ptr;#endif   png_read_destroy(png_ptr, info_ptr, end_info_ptr);   if (info_ptr != NULL)   {#if defined(PNG_TEXT_SUPPORTED)      png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, -1);#endif#ifdef PNG_USER_MEM_SUPPORTED      png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn,          (png_voidp)mem_ptr);#else      png_destroy_struct((png_voidp)info_ptr);#endif      *info_ptr_ptr = NULL;   }   if (end_info_ptr != NULL)   {#if defined(PNG_READ_TEXT_SUPPORTED)      png_free_data(png_ptr, end_info_ptr, PNG_FREE_TEXT, -1);#endif#ifdef PNG_USER_MEM_SUPPORTED      png_destroy_struct_2((png_voidp)end_info_ptr, (png_free_ptr)free_fn,         (png_voidp)mem_ptr);#else      png_destroy_struct((png_voidp)end_info_ptr);#endif      *end_info_ptr_ptr = NULL;   }   if (png_ptr != NULL)   {#ifdef PNG_USER_MEM_SUPPORTED      png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn,          (png_voidp)mem_ptr);#else      png_destroy_struct((png_voidp)png_ptr);#endif      *png_ptr_ptr = NULL;   }}