From: Ben Pfaff Date: Tue, 19 Jan 2010 06:10:30 +0000 (-0800) Subject: ascii: Fix closing pipe files in ascii_destroy(). X-Git-Tag: fc11-i386-build78~1 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c53e5d60298cba39cad94ad6daa14e6038a6762c;p=pspp-builds.git ascii: Fix closing pipe files in ascii_destroy(). Files that are opened with fn_open() must be closed with fn_close(), but ascii_destroy() wasn't doing that. This made a particular difference for interactive output where fn_close() calls pclose() instead of fclose(). --- diff --git a/src/output/ascii.c b/src/output/ascii.c index afd91526..d821993e 100644 --- a/src/output/ascii.c +++ b/src/output/ascii.c @@ -333,6 +333,8 @@ ascii_destroy (struct output_driver *driver) if (a->y > 0) ascii_close_page (a); + if (a->file != NULL) + fn_close (a->file_name, a->file); free (a->title); free (a->subtitle); free (a->file_name); @@ -340,8 +342,6 @@ ascii_destroy (struct output_driver *driver) for (i = 0; i < LNS_COUNT; i++) free (a->box[i]); free (a->init); - if (a->file != NULL) - fclose (a->file); for (i = 0; i < a->allocated_lines; i++) free (a->lines[i].chars); free (a->lines);