From: Kim Nguyễn Date: Thu, 29 Mar 2012 11:58:26 +0000 (+0200) Subject: Fix memory leak in printing code. X-Git-Url: http://git.nguyen.vg/gitweb/?p=SXSI%2FXMLTree.git;a=commitdiff_plain;h=6705d3d650a0823115d712cbf9a46b6c10f4e04c Fix memory leak in printing code. --- 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); }