From 5beffdda43634370653661d5a0f5e3c75aa28747 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sun, 8 Oct 2006 01:49:15 +0000 Subject: [PATCH] Memory leak patrol. --- src/language/stats/ChangeLog | 5 +++++ src/language/stats/rank.q | 9 +++++++-- src/output/ChangeLog | 7 +++++++ src/output/html.c | 2 ++ src/output/table.c | 1 + 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/language/stats/ChangeLog b/src/language/stats/ChangeLog index 9d45ca7b..c96b2861 100644 --- a/src/language/stats/ChangeLog +++ b/src/language/stats/ChangeLog @@ -1,3 +1,8 @@ +Sun Oct 8 09:45:40 WST 2006 John Darrington + + * rank.q: Plugged a small memory leak which occurred under error + conditions. + Sat Oct 7 11:06:01 WST 2006 John Darrington * rank.q: Implemented most of the RANK command. diff --git a/src/language/stats/rank.q b/src/language/stats/rank.q index c102d195..59846c85 100644 --- a/src/language/stats/rank.q +++ b/src/language/stats/rank.q @@ -264,7 +264,8 @@ rank_cmd (const struct sort_criteria *sc, /* Obtain active file in CF. */ if (!procedure (NULL, NULL)) - return false; + goto error; + cf = proc_capture_output (); /* Sort CF into SORTED_CF. */ @@ -285,9 +286,13 @@ rank_cmd (const struct sort_criteria *sc, proc_set_source (storage_source_create (out)); } - free (criteria.crits); + free (criteria.crits); return result ; + +error: + free (criteria.crits); + return false ; } /* Hardly a rank function !! */ diff --git a/src/output/ChangeLog b/src/output/ChangeLog index b7e72cc7..60fd5761 100644 --- a/src/output/ChangeLog +++ b/src/output/ChangeLog @@ -1,3 +1,10 @@ +Sun Oct 8 07:09:34 WST 2006 John Darrington + + * table.c (tab_destroy): Freed title, since this is not allocated + from the pool. + + * html.c (html_open_driver): Freed chart_file_name. + Wed Jul 12 21:03:37 2006 Ben Pfaff * table.c (tab_natural_width): Get rid of warning on empty column, diff --git a/src/output/html.c b/src/output/html.c index 021200bc..72ca57d9 100644 --- a/src/output/html.c +++ b/src/output/html.c @@ -87,10 +87,12 @@ html_open_driver (struct outp_driver *this, struct substring options) fputs (" LINK=\"#1f00ff\" ALINK=\"#ff0000\" VLINK=\"#9900dd\">\n", x->file); print_title_tag (x->file, "H1", outp_title); print_title_tag (x->file, "H2", outp_subtitle); + free (x->chart_file_name); return true; error: + free (x->chart_file_name); this->class->close_driver (this); return false; } diff --git a/src/output/table.c b/src/output/table.c index 8d5ed12b..a7dc4817 100644 --- a/src/output/table.c +++ b/src/output/table.c @@ -87,6 +87,7 @@ void tab_destroy (struct tab_table *t) { assert (t != NULL); + free (t->title); pool_destroy (t->container); } -- 2.30.2