$NetBSD: patch-ab,v 1.1 2002/03/14 05:23:04 fredb Exp $ --- png.c.orig Fri Apr 19 21:57:13 1996 +++ png.c @@ -120,10 +120,17 @@ return (Image *) 0; } + /* initialize the structures */ + pngp = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + info = png_create_info_struct(pngp); + /* set error handling */ - if (setjmp(pngp->jmpbuf)) + if (setjmp(png_jmpbuf(pngp))) { - png_read_destroy(pngp, info, (png_info *)0); + if (info) + png_destroy_read_struct(&pngp, &info, NULL); + else + png_destroy_read_struct(&pngp, NULL, NULL); zclose(zfp); lfree(pngp); lfree(info); @@ -132,10 +139,6 @@ /* If we get here, we had a problem reading the file */ return (Image *) 0; } - - /* initialize the structures, info first for error handling */ - png_info_init(info); - png_read_init(pngp); /* set up the input control */ png_set_read_fn(pngp, (void *) zfp, xli_png_read_data);