From a232828cad44fea0f7d85da1665f42c235b6e3b2 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 24 Jan 2005 07:05:36 +0000 Subject: [PATCH] (print_trns_free) Close the dfm writer if there is one, fixing a memory leak. --- src/ChangeLog | 5 +++++ src/print.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index db74ea37..a7e6320a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +Sun Jan 23 23:02:21 2005 Ben Pfaff + + * print.c: (print_trns_free) Close the dfm writer if there is one, + fixing a memory leak. + Mon Jan 24 12:24:36 WST 2005 John Darrington * glob.c oneway.q q2c.c t-test.q vfm.c: Still *more* memory leaks diff --git a/src/print.c b/src/print.c index b2ef755c..33c800c7 100644 --- a/src/print.c +++ b/src/print.c @@ -977,9 +977,10 @@ print_trns_proc (struct trns_header * trns, struct ccase * c, static void print_trns_free (struct trns_header * t) { + struct print_trns *prt = (struct print_trns *) t; struct prt_out_spec *i, *n; - for (i = ((struct print_trns *) t)->spec; i; i = n) + for (i = prt->spec; i; i = n) { switch (i->type) { @@ -998,7 +999,9 @@ print_trns_free (struct trns_header * t) n = i->next; free (i); } - free (((struct print_trns *) t)->line); + if (prt->writer != NULL) + dfm_close_writer (prt->writer); + free (prt->line); } /* PRINT SPACE. */ -- 2.30.2