From 6705d3d650a0823115d712cbf9a46b6c10f4e04c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kim=20Nguy=E1=BB=85n?= Date: Thu, 29 Mar 2012 13:58:26 +0200 Subject: [PATCH] Fix memory leak in printing code. --- XMLTree.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/XMLTree.cpp b/XMLTree.cpp index 20e6801..a7ee254 100644 --- a/XMLTree.cpp +++ b/XMLTree.cpp @@ -700,7 +700,7 @@ void XMLTree::Print(int fd,treeNode x, bool no_text){ if (first_idx != NULLT) current_text = GetText(MyTextUnsafe(first_idx)); - + uchar * orig_text = current_text; size_t read = 0; while (n <= fin){ @@ -772,5 +772,7 @@ void XMLTree::Print(int fd,treeNode x, bool no_text){ tag = Tag(n); }; _dputc('\n', fd); + if (orig_text && text_index_type != (TextCollectionBuilder::index_type_default)) + Text->DeleteText(orig_text); //_flush(fd); } -- 2.17.1