diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 860bbd40d4..7f6e64e78f 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -584,6 +584,14 @@ errfinish(const char *filename, int lineno, const char *funcname) * worthy of panic, depending on which subprocess returns it. */ proc_exit(1); + + /* + * Closes all of the calling process's open streams. + * On Windows, close and remove all temporary files created by tmpfile function. + */ + #ifdef NDEBUG + fcloseall(); + #endif } if (elevel >= PANIC) @@ -596,6 +604,15 @@ errfinish(const char *filename, int lineno, const char *funcname) * children... */ fflush(NULL); + + /* + * Closes all of the calling process's open streams. + * On Windows, close and remove all temporary files created by tmpfile function. + */ + #ifdef NDEBUG + fcloseall(); + #endif + abort(); }