[gs-cvs] rev 9064 - trunk/gs/base
ray at ghostscript.com
ray at ghostscript.com
Wed Sep 3 13:49:14 PDT 2008
Author: ray
Date: 2008-09-03 13:49:13 -0700 (Wed, 03 Sep 2008)
New Revision: 9064
Modified:
trunk/gs/base/gxclmem.c
Log:
Add protection for the "finish" exit point for potential (no longer exists
since rev 9062) case when f==NULL when code >= 0. Belt and suspenders couldn't
hurt to improve maintainability (prevent future problems). Original problem
reported by Coverity analysis.
Modified: trunk/gs/base/gxclmem.c
===================================================================
--- trunk/gs/base/gxclmem.c 2008-09-03 12:20:27 UTC (rev 9063)
+++ trunk/gs/base/gxclmem.c 2008-09-03 20:49:13 UTC (rev 9064)
@@ -395,10 +395,13 @@
#endif
finish:
- if (code < 0) {
+ /* 'f' shouldn't be NULL unless code < 0, but be careful */
+ if (code < 0 || f == NULL) {
/* return failure, clean up memory before leaving */
if (f != NULL)
memfile_fclose((clist_file_ptr)f, fname, true);
+ if (code >= 0)
+ code = gs_error_ioerror;
} else {
/* return success */
f->is_open = true;
More information about the gs-cvs
mailing list