--- parser3/src/classes/xdoc.C 2004/02/17 15:01:01 1.134 +++ parser3/src/classes/xdoc.C 2004/02/17 15:08:14 1.136 @@ -9,7 +9,7 @@ #ifdef XML -static const char * const IDENT_XDOC_C="$Date: 2004/02/17 15:01:01 $"; +static const char * const IDENT_XDOC_C="$Date: 2004/02/17 15:08:14 $"; #include "gdome.h" #include "libxml/tree.h" @@ -636,6 +636,12 @@ pa_xsltSaveResultToMem( ||xmlStrEqual(method, (const xmlChar *) "xhtml"))) { if (indent == -1) indent = 1; + // + // * xmlDocDumpFormatMemoryEnc: + // Note it is up to the caller of this function to free the + // allocated memory with xmlFree() + // + // we wont free anything, and wont copy that data anymore [already done inside and zeroterminated] xmlDocDumpFormatMemoryEnc(result, &doc_txt_ptr, &doc_txt_len, (const char *) encoding, indent); } else if ((method != NULL) && @@ -739,13 +745,12 @@ pa_xsltSaveResultToMem( doc_txt_len=buf->buffer->use; doc_txt_ptr=buf->buffer->content; } - } - if(doc_txt_ptr && doc_txt_len) - doc_txt_ptr=BAD_CAST pa_strdup((const char*)doc_txt_ptr, doc_txt_len); + if(doc_txt_ptr && doc_txt_len) + doc_txt_ptr=BAD_CAST pa_strdup((const char*)doc_txt_ptr, doc_txt_len); - if(buf) xmlOutputBufferClose(buf); + } } struct Xdoc2buf_result { @@ -797,8 +802,8 @@ static Xdoc2buf_result xdoc2buf(Request& xmlDoc *document=gdome_xml_doc_get_xmlDoc(vdoc.get_document()); document->encoding=BAD_CAST xmlMemStrdup(encoder_name); - xmlChar* doc_txt_ptr; - int doc_txt_len; + xmlChar* doc_txt_ptr=0; + int doc_txt_len=0; pa_xsltSaveResultToMem(doc_txt_ptr, doc_txt_len, document, stylesheet.get(), encoder); if(xmlHaveGenericErrors()) { GdomeException exc=0;