summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2001-12-04 19:03:42 +0000
committerSimon Tatham <anakin@pobox.com>2001-12-04 19:03:42 +0000
commit7f379058ad6686095acc2e8bfbcadc360e08b0f8 (patch)
tree5319eec0a5326745198e13ba8ce2f70881a7fffe
parentec2134d20f485b8fbf75632edf895f3aa9073227 (diff)
downloadhalibut-7f379058ad6686095acc2e8bfbcadc360e08b0f8.zip
halibut-7f379058ad6686095acc2e8bfbcadc360e08b0f8.tar.gz
halibut-7f379058ad6686095acc2e8bfbcadc360e08b0f8.tar.bz2
halibut-7f379058ad6686095acc2e8bfbcadc360e08b0f8.tar.xz
Fix memory management error (don't free a linked list by freeing x
and _then_ setting x = x->next!). [originally from svn r1445]
-rw-r--r--bk_xhtml.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bk_xhtml.c b/bk_xhtml.c
index 4dc9710..5bc52cf 100644
--- a/bk_xhtml.c
+++ b/bk_xhtml.c
@@ -596,11 +596,14 @@ void xhtml_backend(paragraph *sourceform, keywordlist *in_keywords, index *in_id
xhtml_do_index();
/* release file, section, index data structures */
- for (xsect = topsection; xsect!=NULL; xsect=xsect->chain) {
+ xsect = topsection;
+ while (xsect) {
+ xhtmlsection *tmp = xsect->chain;
if (xsect->fragment) {
sfree(xsect->fragment);
}
sfree(xsect);
+ xsect = tmp;
}
xhtml_free_file(topfile);
for (ti = 0; (ientry=(indexentry *)index234(idx->entries, ti))!=NULL; ti++) {