helpcompiler/source/BasCodeTagger.cxx |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

New commits:
commit 62fb1958f6ac4d238e98cfb6b497f5990615450f
Author: Caolán McNamara <caol...@redhat.com>
Date:   Wed Feb 13 11:50:35 2013 +0000

    make building help not crash
    
    a) subStr is not ours to delete, belongs to the OString
    b) and anyway subStr points to the buffer of the out-of-scope temporary 
OString
    
    Change-Id: I1689c6626c52ae9d94e0cfa5de4235be3c1f3262

diff --git a/helpcompiler/source/BasCodeTagger.cxx 
b/helpcompiler/source/BasCodeTagger.cxx
index 5852912..a984eb7 100644
--- a/helpcompiler/source/BasCodeTagger.cxx
+++ b/helpcompiler/source/BasCodeTagger.cxx
@@ -143,17 +143,14 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph )
     m_Highlighter.notifyChange ( 0, 0, &strLine, 1 );
     HighlightPortions portions;
     m_Highlighter.getHighlightPortions( 0, strLine, portions );
-    xmlChar* subStr;
-    xmlChar* typeStr;
-    xmlNodePtr text;
     for ( size_t i=0; i<portions.size(); i++ )
     {
         HighlightPortion& r = portions[i];
-        subStr = (xmlChar*) OUStringToOString( strLine.copy( r.nBegin, 
r.nEnd-r.nBegin ), RTL_TEXTENCODING_UTF8 ).getStr();
-        text = xmlNewText( subStr );
+        OString sToken(OUStringToOString(strLine.copy(r.nBegin, 
r.nEnd-r.nBegin), RTL_TEXTENCODING_UTF8));
+        xmlNodePtr text = xmlNewText((const xmlChar*)sToken.getStr());
         if ( r.tokenType != TT_WHITESPACE )
         {
-            typeStr = getTypeString( r.tokenType );
+            xmlChar* typeStr = getTypeString( r.tokenType );
             curNode = xmlNewTextChild( paragraph, 0, (xmlChar*)"item", 0 );
             xmlNewProp( curNode, (xmlChar*)"type", typeStr );
             xmlAddChild( curNode, text );
@@ -161,7 +158,6 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph )
         }
         else
             xmlAddChild( paragraph, text );
-        xmlFree( subStr );
     }
     xmlFree( codeSnippet );
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to