[xiph-commits] r16414 - branches/theora-thusnelda/examples
giles at svn.xiph.org
giles at svn.xiph.org
Tue Aug 4 10:03:30 PDT 2009
Author: giles
Date: 2009-08-04 10:03:30 -0700 (Tue, 04 Aug 2009)
New Revision: 16414
Modified:
branches/theora-thusnelda/examples/png2theora.c
Log:
Clean up after failing to open and read a png file.
Modified: branches/theora-thusnelda/examples/png2theora.c
===================================================================
--- branches/theora-thusnelda/examples/png2theora.c 2009-08-04 07:08:07 UTC (rev 16413)
+++ branches/theora-thusnelda/examples/png2theora.c 2009-08-04 17:03:30 UTC (rev 16414)
@@ -365,6 +365,7 @@
if(png_sig_cmp(header, 0, 8)) {
fprintf(stderr, "%s: error: %s\n",
pathname, "not a PNG");
+ fclose(fp);
return 1;
}
@@ -373,6 +374,7 @@
if(!png_ptr) {
fprintf(stderr, "%s: error: %s\n",
pathname, "couldn't create png read structure");
+ fclose(fp);
return 1;
}
@@ -380,7 +382,8 @@
if(!info_ptr) {
fprintf(stderr, "%s: error: %s\n",
pathname, "couldn't create png info structure");
- /* XXX: cleanup */
+ png_destroy_read_struct(&png_ptr, NULL, NULL);
+ fclose(fp);
return 1;
}
@@ -388,7 +391,8 @@
if(!end_ptr) {
fprintf(stderr, "%s: error: %s\n",
pathname, "couldn't create png info structure");
- /* XXX: cleanup */
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ fclose(fp);
return 1;
}
More information about the commits
mailing list