From 677e18a2517d5f6c8f30e278048748153643f22d Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 23 Aug 2002 14:02:01 +0000 Subject: [PATCH] Just had a play with this newfangled `valgrind' memory debugger thingy, which seems moderately cool and has reported a few very small memory leaks. Now apparently fixed. git-svn-id: svn://svn.tartarus.org/sgt/halibut@1863 cda61777-01e9-0310-a592-d414129be87e --- bk_text.c | 9 ++++++++- bk_xhtml.c | 8 ++++++++ input.c | 7 ++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/bk_text.c b/bk_text.c index b682b42..1c8cfb9 100644 --- a/bk_text.c +++ b/bk_text.c @@ -313,7 +313,14 @@ void text_backend(paragraph *sourceform, keywordlist *keywords, * Tidy up */ fclose(fp); - sfree(conf.bullet.text); + { + int i; + sfree(conf.achapter.number_suffix); + for (i = 0; i < conf.nasect; i++) + sfree(conf.asect[i].number_suffix); + sfree(conf.asect); + sfree(conf.bullet.text); + } } /* diff --git a/bk_xhtml.c b/bk_xhtml.c index 22173d5..edab934 100644 --- a/bk_xhtml.c +++ b/bk_xhtml.c @@ -28,6 +28,7 @@ #include #include +#include #include #include "halibut.h" @@ -675,6 +676,13 @@ void xhtml_backend(paragraph *sourceform, keywordlist *in_keywords, } ientry->backend_data = NULL; } + { + int i; + sfree(conf.fchapter.number_suffix); + for (i = 0; i < conf.nfsect; i++) + sfree(conf.fsect[i].number_suffix); + sfree(conf.fsect); + } } static int xhtml_para_level(paragraph *p) diff --git a/input.c b/input.c index 2e0dabf..d4ecaeb 100644 --- a/input.c +++ b/input.c @@ -547,7 +547,7 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) { } already = FALSE; if (t.type == tok_eof) - return; + break; /* * Parse code paragraphs separately. @@ -1181,6 +1181,11 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) { stk_free(parsestk); addpara(par, ret); } + + /* + * We break to here rather than returning, because otherwise + * this cleanup doesn't happen. + */ dtor(t); macrocleanup(macros); } -- 2.11.0