summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2008-05-12 16:30:17 +0000
committerMichael Meskes <meskes@postgresql.org>2008-05-12 16:30:17 +0000
commitf496eb31b27856570eb62c16c00b0717fb0b63e7 (patch)
tree7c1ff3f8fdde8ddc5ea9fbb0badf55a999ea73e9 /src/interfaces/ecpg/preproc
parentcc22720644176e7caaa9d6534c00885ef51a80dd (diff)
Check for non-existant connection in prepare statement handling.
Do not close files that weren't opened.
Diffstat (limited to 'src/interfaces/ecpg/preproc')
-rw-r--r--src/interfaces/ecpg/preproc/preproc.y8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index 8f660694a18..5f576276b50 100644
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.359.2.2 2008/03/01 03:26:44 tgl Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.359.2.3 2008/05/12 16:30:17 meskes Exp $ */
/* Copyright comment */
%{
@@ -87,8 +87,10 @@ mmerror(int error_code, enum errortype type, char * error, ...)
ret_value = error_code;
break;
case ET_FATAL:
- fclose(yyin);
- fclose(yyout);
+ if (yyin)
+ fclose(yyin);
+ if (yyout)
+ fclose(yyout);
if (unlink(output_filename) != 0 && *output_filename != '-')
fprintf(stderr, "Could not remove output file %s!\n", output_filename);
exit(error_code);