From 6a856ba6fc06843fd02886087c769247de4d08f0 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Fri, 8 Dec 2006 22:24:08 +0000 Subject: [PATCH] Memory leak patrol and minor cleanups. --- src/data/ChangeLog | 5 +++++ src/data/value-labels.c | 11 ++++++++++- src/libpspp/ChangeLog | 4 ++++ src/libpspp/array.c | 1 - src/ui/gui/ChangeLog | 4 ++++ src/ui/gui/syntax-editor.c | 2 +- src/ui/terminal/ChangeLog | 4 ++++ src/ui/terminal/msg-ui.c | 1 + 8 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/data/ChangeLog b/src/data/ChangeLog index 29e97ff5..3d06ed27 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,3 +1,8 @@ +Sat Dec 9 07:18:03 WST 2006 John Darrington + + * value-labels.c (destroy_atoms): New function. + * value-labels.c (atom_create): Call destroy_atoms in atexit handler. + Thu Dec 7 17:38:26 2006 Ben Pfaff Thanks to Jason Stover for pointing out this problem. diff --git a/src/data/value-labels.c b/src/data/value-labels.c index 96d839ba..357ab4fc 100644 --- a/src/data/value-labels.c +++ b/src/data/value-labels.c @@ -447,6 +447,12 @@ static hsh_free_func free_atom; /* Hash table of atoms. */ static struct hsh_table *atoms; +static void +destroy_atoms (void) +{ + hsh_destroy (atoms); +} + /* Creates and returns an atom for STRING. */ static struct atom * atom_create (const char *string) @@ -457,7 +463,10 @@ atom_create (const char *string) assert (string != NULL); if (atoms == NULL) - atoms = hsh_create (8, compare_atoms, hash_atom, free_atom, NULL); + { + atoms = hsh_create (8, compare_atoms, hash_atom, free_atom, NULL); + atexit (destroy_atoms); + } a.string = (char *) string; app = hsh_probe (atoms, &a); diff --git a/src/libpspp/ChangeLog b/src/libpspp/ChangeLog index 45158bdb..8e197d99 100644 --- a/src/libpspp/ChangeLog +++ b/src/libpspp/ChangeLog @@ -1,3 +1,7 @@ +Sat Dec 9 07:19:01 WST 2006 John Darrington + + * array.c: Removed gratuitous #include + Thu Dec 7 20:33:23 WST 2006 John Darrington * getl.c getl.h : Changed signature of create function to take a diff --git a/src/libpspp/array.c b/src/libpspp/array.c index da2c76e9..2f6ae1c2 100644 --- a/src/libpspp/array.c +++ b/src/libpspp/array.c @@ -91,7 +91,6 @@ #include #include "array.h" -#include #include #include #include diff --git a/src/ui/gui/ChangeLog b/src/ui/gui/ChangeLog index 2c04876d..0b8aee88 100644 --- a/src/ui/gui/ChangeLog +++ b/src/ui/gui/ChangeLog @@ -1,3 +1,7 @@ +Sat Dec 9 07:19:53 WST 2006 John Darrington + + * syntax-editor.c : New file. + Tue Oct 31 19:25:31 2006 Ben Pfaff * var-type-dialog.c: Add missing "#include ". diff --git a/src/ui/gui/syntax-editor.c b/src/ui/gui/syntax-editor.c index 4efbd98c..cc68cdce 100644 --- a/src/ui/gui/syntax-editor.c +++ b/src/ui/gui/syntax-editor.c @@ -81,7 +81,7 @@ save_if_modified (struct syntax_editor *se) GError *err = NULL; if ( ! save_editor_to_file (se, se->name ? se->name : _("Untitled"), - err) ) + &err) ) { msg (ME, err->message); g_error_free (err); diff --git a/src/ui/terminal/ChangeLog b/src/ui/terminal/ChangeLog index cebce364..21326230 100644 --- a/src/ui/terminal/ChangeLog +++ b/src/ui/terminal/ChangeLog @@ -1,3 +1,7 @@ +Sat Dec 9 07:21:02 WST 2006 John Darrington + + * msg-ui.c (msg_ui_done): call msg_locator_done. + Sun Dec 3 11:57:00 2006 Ben Pfaff * read-line.c (read_interactive): Always read GETL_INTERACTIVE diff --git a/src/ui/terminal/msg-ui.c b/src/ui/terminal/msg-ui.c index 6a67a6f1..9cbbf10f 100644 --- a/src/ui/terminal/msg-ui.c +++ b/src/ui/terminal/msg-ui.c @@ -76,6 +76,7 @@ void msg_ui_done (void) { msg_done (); + msg_locator_done (); if ( msg_file ) /* FIXME: do we really want to close stdout ?? */ fclose (msg_file); -- 2.30.2