diff options
author | Ali Abdin <aliabdin@aucegypt.edu> | 2001-01-02 18:29:27 +0000 |
---|---|---|
committer | Ali Abdin <rakholh@src.gnome.org> | 2001-01-02 18:29:27 +0000 |
commit | 5e4969d55a43447f9f3992909ee638312c745ebb (patch) | |
tree | 2a3950e16bb1ea3dddd475ea4834d8fb61254463 | |
parent | fd873a2e038d041b31fb2b226d33b979751c5ba4 (diff) | |
download | nautilus-5e4969d55a43447f9f3992909ee638312c745ebb.tar.gz |
A minor attempt at deallocating things correctly before we exit (so memory
2001-01-02 Ali Abdin <aliabdin@aucegypt.edu>
A minor attempt at deallocating things correctly before we exit (so
memory profilers can be used properly).
* components/help/converters/gnome-db2html2/gdb3html.c:
(parse_file): Free stuff that has been allocated by libxml before
exiting this function. Now memprof stops showing one big large red
bar.
Call toc_free_data when done with the TOC.
* components/help/converters/gnome-db2html2/toc-elements.c:
(toc_copyright_characters): Add a comment about a memory leak I
discovered.
(toc_free_data): New function to free data allocated by toc_init_data
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | components/help/converters/gnome-db2html2/gdb3html.c | 8 | ||||
-rw-r--r-- | components/help/converters/gnome-db2html2/toc-elements.c | 14 | ||||
-rw-r--r-- | components/help/converters/gnome-db2html2/toc-elements.h | 1 |
4 files changed, 39 insertions, 1 deletions
@@ -1,3 +1,20 @@ +2001-01-02 Ali Abdin <aliabdin@aucegypt.edu> + + A minor attempt at deallocating things correctly before we exit (so + memory profilers can be used properly). + + * components/help/converters/gnome-db2html2/gdb3html.c: + (parse_file): Free stuff that has been allocated by libxml before + exiting this function. Now memprof stops showing one big large red + bar. + + Call toc_free_data when done with the TOC. + + * components/help/converters/gnome-db2html2/toc-elements.c: + (toc_copyright_characters): Add a comment about a memory leak I + discovered. + (toc_free_data): New function to free data allocated by toc_init_data + 2001-01-02 John Sullivan <sullivan@eazel.com> reviewed by: Darin Adler <darin@eazel.com> diff --git a/components/help/converters/gnome-db2html2/gdb3html.c b/components/help/converters/gnome-db2html2/gdb3html.c index b162ceb68..0e9f8728d 100644 --- a/components/help/converters/gnome-db2html2/gdb3html.c +++ b/components/help/converters/gnome-db2html2/gdb3html.c @@ -838,9 +838,17 @@ parse_file (gchar *filename, gchar *section, char *arg) print_footer (NULL, NULL, temp_uri); g_free (temp_uri); } + toc_free_data (context->data); } + /* Set this to NULL so xmlFreeParserCtxt does not try to free this static memory */ + context->ParserCtxt->sax = NULL; + if (context->ParserCtxt->myDoc) { + xmlFreeDoc (context->ParserCtxt->myDoc); + } + xmlFreeParserCtxt (context->ParserCtxt); g_free (context->base_path); + g_free (context); } int diff --git a/components/help/converters/gnome-db2html2/toc-elements.c b/components/help/converters/gnome-db2html2/toc-elements.c index b32316492..3afdadec3 100644 --- a/components/help/converters/gnome-db2html2/toc-elements.c +++ b/components/help/converters/gnome-db2html2/toc-elements.c @@ -167,6 +167,15 @@ toc_init_data (void) return (gpointer) retval; } +void +toc_free_data (gpointer data) +{ + TocContext *to_free; + + to_free = (TocContext *) data; + g_free (to_free->header); + g_free (to_free); +} static void toc_sect_start_element (Context *context, @@ -332,9 +341,10 @@ toc_artheader_end_element (Context *context, const gchar *name) g_print ("<BR>"); } g_print ("<P>"); - if ((header->copyright_holder) && (header->copyright_year)) + if ((header->copyright_holder) && (header->copyright_year)) { g_print ("<A HREF=\"gnome-help:%s?legalnotice\">%s</A> © %s %s %s", context->base_file, _("Copyright"), header->copyright_year, _("by"),header->copyright_holder); + } g_print ("<HR>\n<H2>%s</H2>\n\n", _("Table of Contents")); g_print ("<P>\n"); } @@ -425,6 +435,8 @@ toc_copyright_characters (Context *context, temp = g_strndup (chars, len); + /* FIXME: Memory is leaked here, especially if we have multiple + * copyright holders. Not a big priority though. */ switch (index) { case COPYRIGHT: if (((StackElement *) context->stack->data)->info->index == YEAR) diff --git a/components/help/converters/gnome-db2html2/toc-elements.h b/components/help/converters/gnome-db2html2/toc-elements.h index 329e5a4b9..b3a100dd9 100644 --- a/components/help/converters/gnome-db2html2/toc-elements.h +++ b/components/help/converters/gnome-db2html2/toc-elements.h @@ -6,5 +6,6 @@ extern ElementInfo toc_elements[]; gpointer toc_init_data (void); +void toc_free_data (gpointer data); #endif |